You are here

public function ViewsExposedForm::validateForm in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/views/src/Form/ViewsExposedForm.php \Drupal\views\Form\ViewsExposedForm::validateForm()

Form validation handler.

Parameters

array $form: An associative array containing the structure of the form.

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

Overrides FormBase::validateForm

File

core/modules/views/src/Form/ViewsExposedForm.php, line 166

Class

ViewsExposedForm
Provides the views exposed form.

Namespace

Drupal\views\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
  $view = $form_state
    ->get('view');
  foreach ([
    'field',
    'filter',
  ] as $type) {

    /** @var \Drupal\views\Plugin\views\ViewsHandlerInterface[] $handlers */
    $handlers =& $view->{$type};
    foreach ($handlers as $key => $handler) {
      $handlers[$key]
        ->validateExposed($form, $form_state);
    }
  }

  /** @var \Drupal\views\Plugin\views\exposed_form\ExposedFormPluginInterface $exposed_form_plugin */
  $exposed_form_plugin = $view->display_handler
    ->getPlugin('exposed_form');
  $exposed_form_plugin
    ->exposedFormValidate($form, $form_state);
}