You are here

public function AmpViewsCarouselStyle::buildOptionsForm in Accelerated Mobile Pages (AMP) 8.3

Provide a form to edit options for this plugin.

Overrides StylePluginBase::buildOptionsForm

File

src/Plugin/views/style/AmpViewsCarouselStyle.php, line 107

Class

AmpViewsCarouselStyle
Style plugin for the carousel view.

Namespace

Drupal\amp\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 carousel.'),
    '#type' => 'textfield',
    '#size' => '30',
    '#default_value' => $this->options['wrapper_class'],
  ];
  $form['type'] = [
    '#type' => 'select',
    '#title' => t('Carousel type'),
    '#default_value' => $this
      ->getSetting('type'),
    '#options' => [
      'carousel' => 'carousel',
      'slides' => 'slides',
    ],
  ];
  $form['layout'] = $this
    ->layoutElement();
  $form['layout']['#description'] .= ' ' . $this
    ->t('The "carousel" type only supports the fixed, fixed-height, and nodisplay layouts. The "slides" type supports the fill, fixed, fixed-height, flex-item, nodisplay, and responsive layouts.');
  $form['width'] = $this
    ->widthElement();
  $form['height'] = $this
    ->heightElement();
  $form['autoplay'] = $this
    ->autoplayElement();
  $form['controls'] = $this
    ->controlsElement();
  $form['loop'] = $this
    ->loopElement();
  $form['#prefix'] = '<div class="description">' . $this
    ->libraryDescription() . '</div>';
}