diff --git a/core/core.services.yml b/core/core.services.yml index 796ece3e9b..e5a8c66950 100644 --- a/core/core.services.yml +++ b/core/core.services.yml @@ -1641,7 +1641,11 @@ services: tags: - { name: placeholder_strategy, priority: -1000 } email.validator: + class: Drupal\Component\Utility\EmailValidator + arguments: ['@email.validator_utility'] + email.validator_utility: class: Egulias\EmailValidator\EmailValidator + public: false update.post_update_registry: class: Drupal\Core\Update\UpdateRegistry factory: ['@update.post_update_registry_factory', create] diff --git a/core/lib/Drupal/Component/Utility/EmailValidator.php b/core/lib/Drupal/Component/Utility/EmailValidator.php new file mode 100644 index 0000000000..4f5f6f2c8f --- /dev/null +++ b/core/lib/Drupal/Component/Utility/EmailValidator.php @@ -0,0 +1,30 @@ +emailValidator = $emailValidator; + } + +} diff --git a/core/lib/Drupal/Component/Utility/EmailValidatorInterface.php b/core/lib/Drupal/Component/Utility/EmailValidatorInterface.php new file mode 100644 index 0000000000..fe9eaaf3db --- /dev/null +++ b/core/lib/Drupal/Component/Utility/EmailValidatorInterface.php @@ -0,0 +1,10 @@ +token = $token; diff --git a/core/modules/contact/src/ContactFormEditForm.php b/core/modules/contact/src/ContactFormEditForm.php index aa94540bb9..b86222e6cc 100644 --- a/core/modules/contact/src/ContactFormEditForm.php +++ b/core/modules/contact/src/ContactFormEditForm.php @@ -2,6 +2,7 @@ namespace Drupal\contact; +use Drupal\Component\Utility\EmailValidatorInterface; use Drupal\Component\Utility\Unicode; use Drupal\Core\DependencyInjection\ContainerInjectionInterface; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -9,7 +10,6 @@ use Drupal\Core\Entity\EntityTypeInterface; use Drupal\Core\Form\ConfigFormBaseTrait; use Drupal\Core\Form\FormStateInterface; -use Egulias\EmailValidator\EmailValidator; use Drupal\Core\Path\PathValidatorInterface; use Drupal\Core\Render\Element\PathElement; @@ -22,7 +22,7 @@ class ContactFormEditForm extends EntityForm implements ContainerInjectionInterf /** * The email validator. * - * @var \Egulias\EmailValidator\EmailValidator + * @var \Drupal\Component\Utility\EmailValidatorInterface */ protected $emailValidator; @@ -36,12 +36,12 @@ class ContactFormEditForm extends EntityForm implements ContainerInjectionInterf /** * Constructs a new ContactFormEditForm. * - * @param \Egulias\EmailValidator\EmailValidator $email_validator + * @param \Drupal\Component\Utility\EmailValidatorInterface $email_validator * The email validator. * @param \Drupal\Core\Path\PathValidatorInterface $path_validator * The path validator service. */ - public function __construct(EmailValidator $email_validator, PathValidatorInterface $path_validator) { + public function __construct(EmailValidatorInterface $email_validator, PathValidatorInterface $path_validator) { $this->emailValidator = $email_validator; $this->pathValidator = $path_validator; } diff --git a/core/modules/system/system.install b/core/modules/system/system.install index 90e62910ef..342b257dc6 100644 --- a/core/modules/system/system.install +++ b/core/modules/system/system.install @@ -1965,3 +1965,10 @@ function system_update_8400(&$sandbox) { $sandbox['#finished'] = $sandbox['current'] == $sandbox['max']; } + +/** + * Clear caches due to changes in email validator service. + */ +function system_update_8401() { + // Empty update to cause a cache rebuild. +} diff --git a/core/modules/update/src/UpdateSettingsForm.php b/core/modules/update/src/UpdateSettingsForm.php index 1860269d60..c938312d45 100644 --- a/core/modules/update/src/UpdateSettingsForm.php +++ b/core/modules/update/src/UpdateSettingsForm.php @@ -2,11 +2,11 @@ namespace Drupal\update; +use Drupal\Component\Utility\EmailValidatorInterface; use Drupal\Core\DependencyInjection\ContainerInjectionInterface; use Symfony\Component\DependencyInjection\ContainerInterface; use Drupal\Core\Form\ConfigFormBase; use Drupal\Core\Form\FormStateInterface; -use Egulias\EmailValidator\EmailValidator; /** * Configure update settings for this site. @@ -16,17 +16,17 @@ class UpdateSettingsForm extends ConfigFormBase implements ContainerInjectionInt /** * The email validator. * - * @var \Egulias\EmailValidator\EmailValidator + * @var \Drupal\Component\Utility\EmailValidatorInterface */ protected $emailValidator; /** * Constructs a new UpdateSettingsForm. * - * @param \Egulias\EmailValidator\EmailValidator $email_validator + * @param \Drupal\Component\Utility\EmailValidatorInterface $email_validator * The email validator. */ - public function __construct(EmailValidator $email_validator) { + public function __construct(EmailValidatorInterface $email_validator) { $this->emailValidator = $email_validator; }