You are here

public function JumpMenu::buildOptionsForm in Views Jump Menu 8

Provide a form to edit options for this plugin.

Overrides StylePluginBase::buildOptionsForm

File

src/Plugin/views/style/JumpMenu.php, line 67

Class

JumpMenu
Class JumpMenu.

Namespace

Drupal\views_jump_menu\Plugin\views\style

Code

public function buildOptionsForm(&$form, FormStateInterface $form_state) {
  parent::buildOptionsForm($form, $form_state);
  $form['wrapper_class'] = [
    '#title' => $this
      ->t('Wrapper class'),
    '#description' => $this
      ->t('The class to provide on the wrapper, outside the select element.'),
    '#type' => 'textfield',
    '#size' => '30',
    '#default_value' => $this->options['wrapper_class'],
  ];
  $form['class'] = [
    '#title' => $this
      ->t('Select class'),
    '#description' => $this
      ->t('The class to provide on the select element itself.'),
    '#type' => 'textfield',
    '#size' => '30',
    '#default_value' => $this->options['class'],
  ];
  $form['label_field'] = [
    '#title' => $this
      ->t('Label field'),
    '#description' => $this
      ->t('The field to use as the text label of each select option.'),
    '#type' => 'select',
    '#options' => $this
      ->getFieldOptions(),
    '#default_value' => $this->options['label_field'],
  ];
  $form['url_field'] = [
    '#title' => $this
      ->t('URL field'),
    '#description' => $this
      ->t('The field to use as the destination URL of each select option.'),
    '#type' => 'select',
    '#options' => $this
      ->getFieldOptions(),
    '#default_value' => $this->options['url_field'],
  ];
  $form['new_window'] = [
    '#title' => $this
      ->t('Open link in new window'),
    '#type' => 'checkbox',
    '#default_value' => $this->options['new_window'],
  ];
  $form['select_text'] = [
    '#title' => $this
      ->t('Select text'),
    '#description' => $this
      ->t('The text to display as the pre-selected option in the jump menu'),
    '#type' => 'textfield',
    '#default_value' => $this->options['select_text'],
  ];
  $form['select_label'] = [
    '#title' => $this
      ->t('Select label'),
    '#description' => $this
      ->t('The description of the jump menu for screen-readers/accessibility.'),
    '#type' => 'textfield',
    '#default_value' => $this->options['select_label'],
  ];
}