function rh_node_form_node_form_alter in Rabbit Hole 7.2
Same name and namespace in other branches
- 8 modules/rh_node/rh_node.module \rh_node_form_node_form_alter()
- 2.x modules/rh_node/rh_node.module \rh_node_form_node_form_alter()
Implements hook_form_FORM_ID_alter().
This will add Rabbit Hole options to the node form. The user will be able to override the default Rabbit Hole options.
File
- modules/
rh_node/ rh_node.module, line 57 - Main module file for Rabbit Hole nodes module.
Code
function rh_node_form_node_form_alter(&$form, $form_state) {
// Add the Rabbit Hole form, and add an extra javascript file that's needed
// for the fieldset summary.
rabbit_hole_form($form, 'node', $form['#node']->type, 'rh_node', $form['#node']);
if (isset($form['rabbit_hole'])) {
$form['rabbit_hole']['#attached']['js'][] = drupal_get_path('module', 'rh_node') . '/rh-node.js';
}
// Add a custom submit function. This is used to disable the redirect to
// node/123 if Rabbit Hole is enabled and the user doesn't have the bypass
// rh_node permission.
if (!user_access('bypass rh_node')) {
$form['actions']['submit']['#submit'][] = 'rh_node_node_form_submit';
}
}