You are here

function ds_field_ui_create_vertical_tabs in Display Suite 8.3

Same name and namespace in other branches
  1. 8.4 includes/field_ui.inc \ds_field_ui_create_vertical_tabs()
  2. 8.2 includes/field_ui.inc \ds_field_ui_create_vertical_tabs()
  3. 7.2 includes/ds.field_ui.inc \ds_field_ui_create_vertical_tabs()
  4. 7 ds.field_ui.inc \ds_field_ui_create_vertical_tabs()

Create vertical tabs.

1 call to ds_field_ui_create_vertical_tabs()
ds_field_ui_fields_layouts in includes/field_ui.inc
Adds the Display Suite fields and layouts to the form.

File

includes/field_ui.inc, line 98
Field UI functions for Display Suite.

Code

function ds_field_ui_create_vertical_tabs(&$form) {

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

  // @todo needs core permission
  $view_mode_admin_access = \Drupal::currentUser()
    ->hasPermission('admin_view_modes');
  if (isset($form['modes'])) {
    $form['modes']['#group'] = 'additional_settings';
    $form['modes']['#weight'] = -10;
    if ($view_mode_admin_access) {
      $url = Url::fromRoute('field_ui.display_mode');
      $form['modes']['view_modes_custom']['#description'] = Link::fromTextAndUrl(t('Manage display modes'), $url)
        ->toString();
    }
  }
}