function EmailExampleGetFormPage::validateForm

Overrides FormBase::validateForm

File

modules/email_example/src/Form/EmailExampleGetFormPage.php, line 104

Class

EmailExampleGetFormPage
File test form class.

Namespace

Drupal\email_example\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
  if (!$this->emailValidator
    ->isValid($form_state->getValue('email'))) {
    $form_state->setErrorByName('email', $this->t('That e-mail address is not valid.'));
  }
}