function ViewsExposedForm::validateForm

Same name in other branches
  1. 9 core/modules/views/src/Form/ViewsExposedForm.php \Drupal\views\Form\ViewsExposedForm::validateForm()
  2. 8.9.x core/modules/views/src/Form/ViewsExposedForm.php \Drupal\views\Form\ViewsExposedForm::validateForm()
  3. 11.x core/modules/views/src/Form/ViewsExposedForm.php \Drupal\views\Form\ViewsExposedForm::validateForm()

Overrides FormBase::validateForm

File

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

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);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.