ViewEditForm::validateForm

public ViewEditForm::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/ViewEditForm.php, line 236

Class

ViewEditForm
Form controller for the Views edit form.

Namespace

Drupal\views_ui

Code

1
2
3
4
5
6
7
8
9
10
11
12
13
public function validateForm(array &$form, FormStateInterface $form_state) {
  parent::validateForm($form, $form_state);
 
  $view = $this->entity;
  if ($view->isLocked()) {
    $form_state->setErrorByName('', $this->t('Changes cannot be made to a locked view.'));
  }
  foreach ($view->getExecutable()->validate() as $display_errors) {
    foreach ($display_errors as $error) {
      $form_state->setErrorByName('', $error);
    }
  }
}
doc_Drupal
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.