You are here

public function LightGallery::validateOptionsForm in Lightgallery 8

Form validator.

Parameters

array $form: The form.

\Drupal\Core\Form\FormStateInterface $form_state: The form state.

Overrides StylePluginBase::validateOptionsForm

File

src/Plugin/views/style/LightGallery.php, line 162

Class

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

Namespace

Drupal\lightgallery\Plugin\views\style

Code

public function validateOptionsForm(array &$form, FormStateInterface $form_state) {
  parent::validateOptionsForm($form, $form_state);

  // Flatten style options array.
  $style_options = $form_state
    ->getValue('style_options');
  $form_state
    ->setValue([
    'style_options',
    'lightgallery',
  ], LightgalleryManager::flattenArray($style_options));

  // Unset nested values.
  $form_state
    ->unsetValue([
    'style_options',
    'lightgallery_core',
  ]);
  $form_state
    ->unsetValue([
    'style_options',
    'lightgallery_thumbs',
  ]);
  $form_state
    ->unsetValue([
    'style_options',
    'lightgallery_autoplay',
  ]);
  $form_state
    ->unsetValue([
    'style_options',
    'lightgallery_full_screen',
  ]);
  $form_state
    ->unsetValue([
    'style_options',
    'lightgallery_pager',
  ]);
  $form_state
    ->unsetValue([
    'style_options',
    'lightgallery_zoom',
  ]);
  $form_state
    ->unsetValue([
    'style_options',
    'lightgallery_hash',
  ]);
}