You are here

function field_group_pre_render_tabs in Field Group 7

Same name and namespace in other branches
  1. 7.2 field_group.module \field_group_pre_render_tabs()

Implements field_group_pre_render_<format-type>. Format type: Vertical tabs wrapper.

Parameters

$element The field group form element.:

$group The Field group object prepared for pre_render.:

$form The root element or form.:

File

./field_group.module, line 992
Fieldgroup module.

Code

function field_group_pre_render_tabs(&$element, $group, &$form) {
  $classes = 'field-group-' . $group->format_type . '-wrapper';
  if (!empty($group->classes)) {
    $classes .= ' ' . $group->classes;
  }
  $id = !empty($element['#id']) ? ' id="' . $element['#id'] . '"' : '';
  $element += array(
    '#type' => 'vertical_tabs',
    '#theme_wrappers' => array(
      'vertical_tabs',
    ),
    '#prefix' => '<div class="' . $classes . '"' . $id . '>',
    '#suffix' => '</div>',
  );

  // By default vertical_tabs don't have titles but you can override it in the theme.
  if (!empty($group->label)) {
    $element['#title'] = check_plain($group->label);
  }
  $element[$group->group_name . '__active_tab'] = array(
    '#type' => 'hidden',
    '#default_value' => '',
    '#attributes' => array(
      'class' => array(
        'vertical-tabs-active-tab',
      ),
    ),
  );
  $element['#attached']['library'][] = array(
    'system',
    'drupal.collapse',
  );
}