You are here

public function ViewsBootstrapTab::buildOptionsForm in Views Bootstrap 8.4

Same name and namespace in other branches
  1. 8.3 src/Plugin/views/style/ViewsBootstrapTab.php \Drupal\views_bootstrap\Plugin\views\style\ViewsBootstrapTab::buildOptionsForm()

Provide a form to edit options for this plugin.

Overrides StylePluginBase::buildOptionsForm

File

src/Plugin/views/style/ViewsBootstrapTab.php, line 55

Class

ViewsBootstrapTab
Style plugin to render each item in an ordered or unordered list.

Namespace

Drupal\views_bootstrap\Plugin\views\style

Code

public function buildOptionsForm(&$form, FormStateInterface $form_state) {
  parent::buildOptionsForm($form, $form_state);
  if (isset($form['grouping'])) {
    unset($form['grouping']);
    $form['tab_field'] = [
      '#type' => 'select',
      '#title' => $this
        ->t('Tab field'),
      '#options' => $this->displayHandler
        ->getFieldLabels(TRUE),
      '#required' => TRUE,
      '#default_value' => $this->options['tab_field'],
      '#description' => $this
        ->t('Select the field that will be used as the tab.'),
    ];
    $form['tab_type'] = [
      '#type' => 'select',
      '#title' => $this
        ->t('Tab Type'),
      '#options' => [
        'tabs' => $this
          ->t('Tabs'),
        'pills' => $this
          ->t('Pills'),
        'list' => $this
          ->t('List'),
      ],
      '#required' => TRUE,
      '#default_value' => $this->options['tab_type'],
    ];
    $form['justified'] = [
      '#type' => 'checkbox',
      '#title' => $this
        ->t('Justified'),
      '#default_value' => $this->options['justified'],
      '#description' => $this
        ->t('Make tabs equal widths of their parent'),
    ];
  }
}