You are here

public function FlexSlider::buildOptionsForm in Flex Slider 8.2

Provide a form to edit options for this plugin.

Overrides StylePluginBase::buildOptionsForm

File

flexslider_views/src/Plugin/views/style/FlexSlider.php, line 59

Class

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

Namespace

Drupal\flexslider_views\Plugin\views\style

Code

public function buildOptionsForm(&$form, FormStateInterface $form_state) {
  parent::buildOptionsForm($form, $form_state);
  $form['flexslider'] = [
    '#type' => 'fieldset',
    '#title' => $this
      ->t('FlexSlider'),
  ];
  $form['flexslider']['optionset'] = [
    '#title' => $this
      ->t('Option set'),
    '#type' => 'select',
    '#options' => flexslider_optionset_list(),
    '#default_value' => $this->options['optionset'],
  ];
  $captionfield_options = [
    '' => $this
      ->t('None'),
  ];
  foreach ($this->displayHandler
    ->getHandlers('field') as $field => $handler) {
    $captionfield_options[$field] = $handler
      ->adminLabel();
  }
  $form['flexslider']['captionfield'] = [
    '#type' => 'select',
    '#title' => $this
      ->t('Caption Field'),
    '#description' => $this
      ->t("Select a field to be used as the caption. This can also be set manually by adding the '.flex-caption' class to a field. Required to use thumbnail captions."),
    '#options' => $captionfield_options,
    '#default_value' => $this->options['captionfield'],
  ];
  $form['flexslider']['id'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Element ID'),
    '#description' => $this
      ->t("Manually define the FlexSlider container ID attribute <em>Ensure you don't display similar ID elements on the same page</em>."),
    '#size' => 40,
    '#maxlength' => 255,
    '#default_value' => $this->options['id'],
  ];
}