You are here

function simplify_form_profile2_form_alter in Simplify 7.3

Implements hook_form_BASE_FORM_ID_alter() for profile2_form.

File

./simplify.module, line 421
Simplifies the user interface by hiding particular fields.

Code

function simplify_form_profile2_form_alter(&$form, &$form_state, $form_id) {
  $bundle = '';
  foreach (element_children($form) as $key) {
    if (isset($form[$key]['#entity_type']) && $form[$key]['#entity_type'] == 'profile2') {
      $bundle = $form[$key]['#bundle'];
    }
  }

  // Get array of fields to hide
  $global_fields = variable_get('simplify_profiles_global', array());
  $type_fields = variable_get('simplify_profiles_' . $bundle, array());
  $fields = array_merge($global_fields, $type_fields);

  // Hide fields
  simplify_hide_fields($fields, $form);
}