You are here

public function ViewsTestDataErrorForm::validateForm in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/views/tests/modules/views_test_data/src/Form/ViewsTestDataErrorForm.php \Drupal\views_test_data\Form\ViewsTestDataErrorForm::validateForm()
  2. 9 core/modules/views/tests/modules/views_test_data/src/Form/ViewsTestDataErrorForm.php \Drupal\views_test_data\Form\ViewsTestDataErrorForm::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 FormInterface::validateForm

File

core/modules/views/tests/modules/views_test_data/src/Form/ViewsTestDataErrorForm.php, line 38

Class

ViewsTestDataErrorForm
Implements a test form that has a validation error.

Namespace

Drupal\views_test_data\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
  $form_state
    ->setErrorByName('text', t('Form validation error'));
}