function TestForm::validateForm
Same name in this branch
- 9 core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php \Drupal\Tests\Core\Form\TestForm::validateForm()
Same name in other branches
- 8.9.x core/modules/block/tests/modules/block_test/src/Form/TestForm.php \Drupal\block_test\Form\TestForm::validateForm()
- 8.9.x core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php \Drupal\Tests\Core\Form\TestForm::validateForm()
- 10 core/modules/block/tests/modules/block_test/src/Form/TestForm.php \Drupal\block_test\Form\TestForm::validateForm()
- 10 core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php \Drupal\Tests\Core\Form\TestForm::validateForm()
- 11.x core/modules/block/tests/modules/block_test/src/Form/TestForm.php \Drupal\block_test\Form\TestForm::validateForm()
- 11.x core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php \Drupal\Tests\Core\Form\TestForm::validateForm()
Overrides FormBase::validateForm
File
-
core/
modules/ block/ tests/ modules/ block_test/ src/ Form/ TestForm.php, line 42
Class
- TestForm
- Form that performs base block form test.
Namespace
Drupal\block_test\FormCode
public function validateForm(array &$form, FormStateInterface $form_state) {
if (strpos($form_state->getValue('email'), '.com') === FALSE) {
$form_state->setErrorByName('email', $this->t('This is not a .com email address.'));
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.