You are here

public function ViewAddForm::validateForm in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/views_ui/src/ViewAddForm.php \Drupal\views_ui\ViewAddForm::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_ui/src/ViewAddForm.php, line 165
Contains \Drupal\views_ui\ViewAddForm.

Class

ViewAddForm
Form controller for the Views edit form.

Namespace

Drupal\views_ui

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
  $wizard_type = $form_state
    ->getValue(array(
    'show',
    'wizard_key',
  ));
  $wizard_instance = $this->wizardManager
    ->createInstance($wizard_type);
  $form_state
    ->set('wizard', $wizard_instance
    ->getPluginDefinition());
  $form_state
    ->set('wizard_instance', $wizard_instance);
  $errors = $wizard_instance
    ->validateView($form, $form_state);
  foreach ($errors as $display_errors) {
    foreach ($display_errors as $name => $message) {
      $form_state
        ->setErrorByName($name, $message);
    }
  }
}