function nodehierarchy_alter_node_form in Node Hierarchy 7.4
Add Node Hierarchy settings to the node form.
1 call to nodehierarchy_alter_node_form()
- nodehierarchy_form_alter in ./
nodehierarchy.module - Implementation of hooks_form_alter().
File
- ./
nodehierarchy.admin.inc, line 46 - Admin functions for Node Hierarchy
Code
function nodehierarchy_alter_node_form(&$form, &$form_state, $form_id) {
$type = isset($form['type']) && isset($form['#node']) ? $form['type']['#value'] : '';
$node = isset($form['#node']) ? $form['#node'] : NULL;
if (isset($node->nid)) {
nodehierarchy_set_breadcrumbs($node, TRUE);
}
$hierarchy_form = module_invoke_all('nodehierarchy_node_form', $node, $form, $form_state);
// If the current user has no nodehierarchy perms, don't show the form.
$access = FALSE;
foreach (nodehierarchy_permission() as $perm => $info) {
if (user_access($perm)) {
$access = TRUE;
break;
}
}
if ($hierarchy_form) {
// Add the js to show the summary.
drupal_add_js(drupal_get_path('module', 'nodehierarchy') . '/nodehierarchy.edit.js');
$weight = function_exists('content_extra_field_weight') ? content_extra_field_weight($type, 'nodehierarchy') : 10;
$form['nodehierarchy'] = array_merge(array(
'#type' => 'fieldset',
'#title' => t('Node Hierarchy'),
'#group' => 'additional_settings',
'#weight' => $weight,
'#access' => $access,
'#attributes' => array(
'class' => array(
'nodehierarchy-form',
),
),
), $hierarchy_form);
}
}