You are here

public function SlickViews::buildOptionsForm in Slick Views 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/views/style/SlickViews.php \Drupal\slick_views\Plugin\views\style\SlickViews::buildOptionsForm()

Overrides parent::buildOptionsForm().

File

src/Plugin/views/style/SlickViews.php, line 72

Class

SlickViews
Slick style plugin.

Namespace

Drupal\slick_views\Plugin\views\style

Code

public function buildOptionsForm(&$form, FormStateInterface $form_state) {
  $fields = [
    'captions',
    'classes',
    'images',
    'layouts',
    'links',
    'overlays',
    'thumbnails',
    'thumb_captions',
    'thumb_positions',
    'titles',
  ];
  $definition = $this
    ->getDefinedFieldOptions($fields);
  foreach ([
    'fieldable_form',
    'grid_form',
    'id',
    'nav',
    'vanilla',
  ] as $key) {
    $definition[$key] = TRUE;
  }
  $this
    ->admin()
    ->buildSettingsForm($form, $definition);
  $count = count($definition['captions']);
  $wide = $count > 2 ? ' form--wide form--caption-' . $count : ' form--caption-' . $count;
  $title = '<p class="form__header form__title">';
  $title .= $this
    ->t('Check Vanilla if using content/custom markups, not fields. <small>See it under <strong>Format > Show</strong> section. Otherwise slick markups apply which require some fields added below.</small>');
  $title .= '</p>';
  $form['opening']['#markup'] = '<div class="form--slick form--views form--half form--vanilla has-tooltip' . $wide . '">' . $title;
  if (isset($form['image'])) {
    $form['image']['#description'] .= ' ' . $this
      ->t('Use Blazy formatter to have it lazyloaded. Other supported Formatters: Colorbox, Intense, Responsive image, Video Embed Field, Youtube Field.');
  }
  if (isset($form['overlay'])) {
    $form['overlay']['#description'] .= ' ' . $this
      ->t('Be sure to CHECK "<strong>Style settings > Use field template</strong>" _only if using Slick formatter for nested sliders, otherwise keep it UNCHECKED!');
  }
}