You are here

function vertical_tabs_form_alter in Vertical Tabs 6

Implements hook_form_alter().

File

./vertical_tabs.module, line 38
Provides vertical tabs capability for fieldsets in forms.

Code

function vertical_tabs_form_alter(&$form, $form_state, $form_id) {

  // Add the support and default groupings for core forms.
  vertical_tabs_add_core_support($form, $form_id);
  $config = vertical_tabs_get_config($form_id);

  // Skip programmed or excluded forms.
  if (!empty($form['#programmed']) || $config === FALSE) {
    vertical_tabs_remove_vertical_tabs($form);
  }
  elseif ($config) {

    // Merge in the vertical tabs settings in case they already existed.
    $form += array(
      '#vertical_tabs' => array(),
    );
    if (is_array($config)) {
      $form['#vertical_tabs'] += $config;
    }
    $form['#pre_render'][] = 'vertical_tabs_form_pre_render';
  }
}