You are here

function nodehierarchy_admin_settings in Node Hierarchy 5

Same name and namespace in other branches
  1. 6.3 nodehierarchy.module \nodehierarchy_admin_settings()
  2. 6 nodehierarchy.module \nodehierarchy_admin_settings()
  3. 6.2 nodehierarchy.module \nodehierarchy_admin_settings()
  4. 7.4 nodehierarchy.admin.inc \nodehierarchy_admin_settings()
  5. 7.2 nodehierarchy.module \nodehierarchy_admin_settings()

Helper function generates admin settings page.

1 string reference to 'nodehierarchy_admin_settings'
nodehierarchy_menu in ./nodehierarchy.module
Implementation of hook_menu().

File

./nodehierarchy.module, line 109
A module to make nodes hierarchical.

Code

function nodehierarchy_admin_settings() {
  $form = array();

  // Individual type settings.
  $form['nodehierarchy_types'] = array(
    '#type' => 'fieldset',
    '#title' => t('Node Type Settings'),
    '#description' => t('Settings for individual node types. These can also be set in the !ct section.', array(
      "!ct" => l(t("Content Types"), "admin/content/types"),
    )),
  );
  foreach (node_get_types() as $key => $type) {

    // Individual type settings.
    $form['nodehierarchy_types'][$key] = array(
      '#type' => 'fieldset',
      '#title' => $type->name,
      '#collapsible' => TRUE,
      '#collapsed' => TRUE,
    );
    $form['nodehierarchy_types'][$key] += _nodehierarchy_get_node_type_settings_form($key, TRUE);
  }

  // Menu generation.
  if (function_exists('menu_parent_options')) {
    $form['nodehierarchy_menu'] = array(
      '#type' => 'fieldset',
      '#title' => t('Node Hierarchy Menu Generation'),
    );
    $form['nodehierarchy_menu']['nodehierarchy_menus'] = array(
      '#type' => 'checkbox',
      '#title' => t('Allow users to generate menus automatically.'),
      '#default_value' => variable_get('nodehierarchy_menus', TRUE),
    );
    $form['nodehierarchy_menu']['nodehierarchy_menu_noadmin'] = array(
      '#type' => 'checkbox',
      '#title' => t('Allow non-admins to create menus items.'),
      '#default_value' => variable_get('nodehierarchy_menu_noadmin', FALSE),
      '#description' => t("If you enable this option users will be able to create menus items using node hierarchy even if they don't have the 'administer menu' permission."),
    );
    $form['nodehierarchy_menu']['nodehierarchy_menus_default'] = array(
      '#type' => 'select',
      '#title' => t('Default parent menu.'),
      '#options' => menu_parent_options(0),
      '#default_value' => variable_get('nodehierarchy_menus_default', 1),
      '#description' => t('If a menu is created for a node with no parent or for a node whose parent has no menu item, the new menu item will appear in this menu.'),
    );
  }
  return system_settings_form($form);
}