ViewAddForm::validateForm

public ViewAddForm::validateForm(array &$form, FormStateInterface $form_state)

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 160

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);
    }
  }
}
doc_Drupal
2016-10-29 09:53:48
Comments
Leave a Comment

Please login to continue.