public function LockrRegisterForm::validateForm in Lockr 8.2
Same name and namespace in other branches
- 8.4 src/Form/LockrRegisterForm.php \Drupal\lockr\Form\LockrRegisterForm::validateForm()
- 8.3 src/Form/LockrRegisterForm.php \Drupal\lockr\Form\LockrRegisterForm::validateForm()
- 4.x src/Form/LockrRegisterForm.php \Drupal\lockr\Form\LockrRegisterForm::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
- src/
Form/ LockrRegisterForm.php, line 77
Class
Namespace
Drupal\lockr\FormCode
public function validateForm(array &$form, FormStateInterface $form_state) {
$email = $form_state
->getValue('email');
if (!$this->emailValidator
->isValid($email)) {
$form_state
->setErrorByName('email', 'Please enter a valid email address.');
}
}