You are here

public function Tabs::settingsForm in Field Group 8.3

Same name and namespace in other branches
  1. 8 src/Plugin/field_group/FieldGroupFormatter/Tabs.php \Drupal\field_group\Plugin\field_group\FieldGroupFormatter\Tabs::settingsForm()

Returns a form to configure settings for the formatter.

Invoked in field_group_field_ui_display_form_alter to allow administrators to configure the formatter. The field_group module takes care of handling submitted form values.

Return value

array The form elements for the formatter settings.

Overrides FieldGroupFormatterBase::settingsForm

File

src/Plugin/field_group/FieldGroupFormatter/Tabs.php, line 90

Class

Tabs
Plugin implementation of the 'horizontal_tabs' formatter.

Namespace

Drupal\field_group\Plugin\field_group\FieldGroupFormatter

Code

public function settingsForm() {
  $form = parent::settingsForm();
  $form['direction'] = [
    '#title' => $this
      ->t('Direction'),
    '#type' => 'select',
    '#options' => [
      'vertical' => $this
        ->t('Vertical'),
      'horizontal' => $this
        ->t('Horizontal'),
    ],
    '#default_value' => $this
      ->getSetting('direction'),
    '#weight' => 1,
  ];
  $form['width_breakpoint'] = [
    '#title' => $this
      ->t('Width Breakpoint'),
    '#description' => $this
      ->t('Auto-disable the Tabs widget if the window width is equal or smaller than this breakpoint.'),
    '#type' => 'number',
    '#default_value' => $this
      ->getSetting('width_breakpoint'),
    '#weight' => 2,
    '#min' => 0,
  ];
  return $form;
}