You are here

function rh_bean_form_bean_form_alter in Rabbit Hole 7.2

Implements hook_form_FORM_ID_alter().

This will add Rabbit Hole options to the bean form when adding a new bean. The user will be able to override the default Rabbit Hole options.

File

modules/rh_bean/rh_bean.module, line 58
Main module file for Rabbit Hole beans module.

Code

function rh_bean_form_bean_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, 'bean', $form_state['bean']->type, 'rh_bean', $form_state['bean']);
  if (isset($form['rabbit_hole'])) {
    $form['#attached']['js'][] = drupal_get_path('module', 'rh_bean') . '/rh-bean.js';
  }

  // Add a custom submit function. This is used to disable the redirect to
  // block/% if Rabbit Hole is enabled and the user doesn't have the bypass
  // rh_bean permission.
  if (!user_access('bypass rh_bean')) {
    $form['actions']['submit']['#submit'][] = 'rh_bean_form_submit';
  }
}