You are here

function _nodehierarchy_get_node_type_settings_form in Node Hierarchy 6.3

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

Get the nodehierarchy setting form for a particular node type.

2 calls to _nodehierarchy_get_node_type_settings_form()
nodehierarchy_admin_settings in ./nodehierarchy.module
Helper function generates admin settings page.
nodehierarchy_form_alter in ./nodehierarchy.module
Implementation of hooks_form_alter().

File

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

Code

function _nodehierarchy_get_node_type_settings_form($type) {
  $form = array();

  // Primary Parent
  $form['parent'] = array(
    '#type' => 'fieldset',
    '#title' => t('Primary Parent'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#tree' => FALSE,
  );
  $form['parent']['nh_parent_node_' . $type] = _nodehierarchy_get_parent_selector($type, variable_get('nh_parent_node_' . $type, 0));
  $form['parent']['nh_parent_node_' . $type]['#description'] = t('If you do not pick a parent for this node type, the node\'s menu item will appear at the top level the default parent menu.');
  $form['parent']['nh_parent_node_override_' . $type] = array(
    '#type' => 'checkbox',
    '#title' => t('Allow changes to parent node'),
    '#default_value' => variable_get('nh_parent_node_override_' . $type, TRUE),
    '#description' => t('If enabled, users will be allowed to override the parent node when creating or editing nodes of this type.'),
  );
  $form['parent']['nh_parent_show_hidden_' . $type] = array(
    '#type' => 'checkbox',
    '#title' => t('Show hidden Node Hierarchy menu items in parent selector'),
    '#default_value' => variable_get('nh_parent_show_hidden_' . $type, TRUE),
    '#description' => t('If enabled, nodes of this type will be allowed to view hidden Node Hierarchy menu items in the parent selector.<br />Disable this if large Node Hierarchy menus are causing memory errors on node edit screens.'),
  );
  $form['parent']['nh_parent_multiple_' . $type] = array(
    '#type' => 'checkbox',
    '#title' => t('Allow multiple parents'),
    '#default_value' => variable_get('nh_parent_multiple_' . $type, 0),
    '#description' => t('If enabled, users will be able to assign multiple parents for nodes of this type.<br /><strong>NOTE:</strong> If you disable "Allow changes to parent node" multiple parents will not function properly.'),
  );

  // Children
  $form['children'] = array(
    '#type' => 'fieldset',
    '#title' => t('Children'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#tree' => FALSE,
  );
  $form['children']['nh_children_access_' . $type] = array(
    '#type' => 'radios',
    '#title' => t('Display children tab'),
    '#default_value' => variable_get('nh_children_access_' . $type, 'always'),
    '#options' => array(
      'never' => t('Never'),
      'exist' => t('Only if children exist'),
      'always' => t('Always'),
    ),
    '#description' => t("If enabled, nodes of this type will show a local task tab named \"Children\" and enables the menu path: \"node/%/children\" for this node type.<br /><strong>Permission Reminder:</strong> Users must also have the <strong>'view children'</strong> !permission before this setting can function properly.", array(
      '!permission' => l('permission', 'admin/user/permissions'),
    )),
  );
  $form['children']['nh_children_allowed_types_' . $type] = array(
    '#type' => 'checkboxes',
    '#title' => t('Allowed node types'),
    '#description' => t('Node types which can be created as child nodes of this node type.'),
    '#options' => node_get_types('names'),
    '#default_value' => nodehierarchy_get_allowed_child_types($type),
  );

  // Menu Generation
  $form['menu'] = array(
    '#type' => 'fieldset',
    '#title' => t('Menu Generation'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#tree' => FALSE,
    '#description' => t("<strong>Permission Reminder:</strong> Users must have the <strong>'administer menu'</strong> or <strong>'customize nodehierarchy menus'</strong> !permission to override default options.", array(
      '!permission' => l('permission', 'admin/user/permissions'),
    )),
  );
  $form['menu']['nh_menu_display_core_' . $type] = array(
    '#type' => 'checkbox',
    '#title' => t('Display core menu fieldset'),
    '#default_value' => variable_get('nh_menu_display_core_' . $type, TRUE),
    '#description' => t('If enabled, nodes of this type will be allowed to show the default core menu fieldset on node edit forms.<br />When disabled, this setting allows Node Hierarchy to be the authoritative delegate on managing menu items.'),
  );
  $form['menu']['nh_menu_change_parent_' . $type] = array(
    '#type' => 'checkbox',
    '#title' => t('Allow changes to default parent menu'),
    '#default_value' => variable_get('nh_menu_change_parent_' . $type, TRUE),
    '#description' => t("If enabled, nodes of this type will be allowed to make changes to the default parent menu. This is not to be<br />confused with this node type's parent node. This is reflective of the default parent menu set for this site."),
  );
  $form['menu']['nh_menu_create_' . $type] = array(
    '#type' => 'radios',
    '#title' => t('Show item in menu'),
    '#default_value' => variable_get('nh_menu_create_' . $type, 'optional_no'),
    '#options' => array(
      'never' => t('Never'),
      'optional_no' => t('Optional - default to no'),
      'optional_yes' => t('Optional - default to yes'),
      'always' => t('Always'),
    ),
  );
  $form['menu']['nh_menu_expand_' . $type] = array(
    '#type' => 'radios',
    '#title' => t('Expand menu item'),
    '#default_value' => variable_get('nh_menu_expand_' . $type, 'optional_no'),
    '#options' => array(
      'never' => t('Never'),
      'optional_no' => t('Optional - default to no'),
      'optional_yes' => t('Optional - default to yes'),
      'always' => t('Always'),
    ),
  );

  // Merge settings from modules that implement 'nodehierarchy_node_type_settings_form' hook
  $form = array_merge_recursive($form, module_invoke_all('nodehierarchy_node_type_settings_form', $type));
  return $form;
}