You are here

public function LockrLoginForm::validateForm in Lockr 8.2

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

src/Form/LockrLoginForm.php, line 113
Contains Drupal\lockr\Form\LockrLoginForm.

Class

LockrLoginForm

Namespace

Drupal\lockr\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
  $email = $form_state
    ->getValue('email');
  if (!$this->emailValidator
    ->isValid($email)) {
    $form_state
      ->setErrorByName('email', $this
      ->t('Please enter a valid email address.'));
  }
}