Abstract Email Validation
The Abstract Email Validation module provides email validation functionality for various entity types and forms in Drupal.
Features
- Adds an email validation option to email fields in various entity types:
- Node
- User
- Paragraph
- Taxonomy
- Menu
- Media
- Can be used in webforms.
- Can be used in custom forms by adding the
#abstract_email_validation
key to the email field and setting it to TRUE.
Installation
- Download and enable the module as you would any other Drupal module.
Configuration
You can configure the Abstract Email Validation module at the following URL:
/admin/config/system/abstract-email-validation
Usage
Entity Types
The module adds an email validation option to email fields in the following entity types:
- Node
- User
- Paragraph
- Taxonomy
- Menu
- Media
Webforms
You can also use the validation in webforms by enabling the validation option in the email field settings.
Custom Forms
To use the validation in custom forms, add the key #abstract_email_validation
to the email field and set it to TRUE. Example:
$form['email'] = [
'#type' => 'email',
'#title' => $this->t('Email'),
'#abstract_email_validation' => TRUE,
];