You are here

public function FilterPluginBase::validateExposeForm in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/views/src/Plugin/views/filter/FilterPluginBase.php \Drupal\views\Plugin\views\filter\FilterPluginBase::validateExposeForm()

Validate the options form.

Overrides HandlerBase::validateExposeForm

1 call to FilterPluginBase::validateExposeForm()
FilterPluginBase::validateOptionsForm in core/modules/views/src/Plugin/views/filter/FilterPluginBase.php
Simple validate handler

File

core/modules/views/src/Plugin/views/filter/FilterPluginBase.php, line 624
Contains \Drupal\views\Plugin\views\filter\FilterPluginBase.

Class

FilterPluginBase
Base class for Views filters handler plugins.

Namespace

Drupal\views\Plugin\views\filter

Code

public function validateExposeForm($form, FormStateInterface $form_state) {
  $identifier = $form_state
    ->getValue(array(
    'options',
    'expose',
    'identifier',
  ));
  if (empty($identifier)) {
    $form_state
      ->setError($form['expose']['identifier'], $this
      ->t('The identifier is required if the filter is exposed.'));
  }
  elseif ($identifier == 'value') {
    $form_state
      ->setError($form['expose']['identifier'], $this
      ->t('This identifier is not allowed.'));
  }
  if (!$this->view->display_handler
    ->isIdentifierUnique($form_state
    ->get('id'), $identifier)) {
    $form_state
      ->setError($form['expose']['identifier'], $this
      ->t('This identifier is used by another handler.'));
  }
}