You are here

function rh_profile2_form_profile2_type_form_alter in Rabbit Hole 7.2

Implements hook_form_FORM_ID_alter().

This will add Rabbit Hole options to the Profile2 type form. These settings will be used as default for every Profile of this Profile type.

_state

Parameters

$form:

File

modules/rh_profile2/rh_profile2.module, line 32
Main module file for Rabbit Hole Profile2 module.

Code

function rh_profile2_form_profile2_type_form_alter(&$form, $form_state) {
  if (!user_access('administer rh_profile2') || empty($form_state['profile2_type']->type)) {

    // The user doesn't have access.
    return;
  }

  // Load the Rabbit Hole form, and add an extra javascript file that's needed
  // for the fieldset summary.
  rabbit_hole_form($form, 'profile2', $form_state['profile2_type']->type, 'rh_profile2');
  if (isset($form['rabbit_hole'])) {
    $form['#attached']['js'][] = drupal_get_path('module', 'rh_profile2') . '/rh-profile2.js';
  }
}