You are here

public function ViewsBootstrapDropdown::buildOptionsForm in Views Bootstrap 8.3

Form for configuring this plugin.

Overrides StylePluginBase::buildOptionsForm

File

src/Plugin/views/style/ViewsBootstrapDropdown.php, line 62

Class

ViewsBootstrapDropdown
Style plugin to render each item as a row in a Bootstrap Dropdown.

Namespace

Drupal\views_bootstrap\Plugin\views\style

Code

public function buildOptionsForm(&$form, FormStateInterface $form_state) {
  $form['help'] = [
    '#markup' => $this
      ->t('The Bootstrap dropdown style displays a list of links in a drop-down menu format (<a href=":docs">see documentation</a>).', [
      ':docs' => 'https://www.drupal.org/docs/contributed-modules/views-bootstrap-for-bootstrap-3/dropdown',
    ]),
    '#weight' => -99,
  ];
  $form['button_text'] = [
    '#title' => $this
      ->t('Button text'),
    '#description' => $this
      ->t('Text label for the button that is the drop-down toggle.'),
    '#type' => 'textfield',
    '#default_value' => $this->options['button_text'],
  ];
  $form['button_class'] = [
    '#title' => $this
      ->t('Button class'),
    '#description' => $this
      ->t('Classes for the button that is the drop-down toggle.'),
    '#type' => 'select',
    '#options' => [
      'btn btn-default' => $this
        ->t('Default'),
      'btn btn-primary' => $this
        ->t('Primary'),
      'btn btn-success' => $this
        ->t('Success'),
      'btn btn-info' => $this
        ->t('Info'),
      'btn btn-warning' => $this
        ->t('Warning'),
      'btn btn-danger' => $this
        ->t('Danger'),
    ],
    '#default_value' => $this->options['button_class'],
  ];
  $form['wrapper_class'] = [
    '#title' => $this
      ->t('Wrapper class'),
    '#description' => $this
      ->t('The class to provide on the wrapper, outside the list.'),
    '#type' => 'textfield',
    '#size' => '30',
    '#default_value' => $this->options['wrapper_class'],
  ];
  $form['class'] = [
    '#title' => $this
      ->t('List class'),
    '#description' => $this
      ->t('The class to provide on the list element itself.'),
    '#type' => 'textfield',
    '#size' => '30',
    '#default_value' => $this->options['class'],
  ];
  parent::buildOptionsForm($form, $form_state);
}