You are here

function field_group_field_ui_create_vertical_tabs in Field Group 7.2

Same name and namespace in other branches
  1. 8.3 includes/field_ui.inc \field_group_field_ui_create_vertical_tabs()
  2. 8 includes/field_ui.inc \field_group_field_ui_create_vertical_tabs()
  3. 7 field_group.field_ui.inc \field_group_field_ui_create_vertical_tabs()

Create vertical tabs.

1 call to field_group_field_ui_create_vertical_tabs()
field_group_field_ui_overview_form_alter in ./field_group.field_ui.inc
Function to alter the fields overview and display overview screen.

File

./field_group.field_ui.inc, line 731
Field_group.field_ui.inc is a file that contains most functions needed on the Fields UI Manage forms (display and fields).

Code

function field_group_field_ui_create_vertical_tabs(&$form, &$form_state, $params) {
  $form_state['field_group_params'] = $params;
  $entity_info = entity_get_info($params->entity_type);
  $view_modes = array();
  if ($params->mode != 'default') {
    $view_modes['default'] = t('Default');
  }
  if ($params->mode != 'form') {
    $view_modes['0'] = t('Form');
  }
  foreach ($entity_info['view modes'] as $view_mode => $data) {
    if ($data['custom settings'] && $params->mode != $view_mode) {
      $view_modes[$view_mode] = $data['label'];
    }
  }

  // Add additional settings vertical tab.
  if (!isset($form['additional_settings'])) {
    $form['additional_settings'] = array(
      '#type' => 'vertical_tabs',
      '#theme_wrappers' => array(
        'vertical_tabs',
      ),
      '#prefix' => '<div>',
      '#suffix' => '</div>',
      '#tree' => TRUE,
    );
    $form['#attached']['js'][] = 'misc/form.js';
    $form['#attached']['js'][] = 'misc/collapse.js';
  }

  // Add extra guidelines for webmaster.
  $form['additional_settings']['field_group'] = array(
    '#type' => 'fieldset',
    '#title' => t('Fieldgroups'),
    '#description' => t('<p class="fieldgroup-help">Fields can be dragged into groups with unlimited nesting. Each fieldgroup format comes with a configuration form, specific for that format type.<br />Note that some formats come in pair. These types have a html wrapper to nest its fieldgroup children. E.g. Place accordion items into the accordion, vertical tabs in vertical tab group and horizontal tabs in the horizontal tab group. There is one exception to this rule, you can use a vertical tab without a wrapper when the additional settings tabs are available. E.g. node forms.</p>'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
    '#parents' => array(
      'additional_settings',
    ),
  );
  $form['additional_settings']['field_group']['fieldgroup_clone'] = array(
    '#title' => t('Select source view mode or form'),
    '#description' => t('Clone fieldgroups from selected view mode to the current display'),
    '#type' => 'select',
    '#options' => $view_modes,
    '#default_value' => 'none',
  );
  $form['additional_settings']['field_group']['fieldgroup_submit'] = array(
    '#type' => 'submit',
    '#value' => t('Clone'),
    '#submit' => array(
      'field_group_field_ui_clone_field_groups',
    ),
  );
}