diff -u b/core/lib/Drupal/Core/Render/Element/Email.php b/core/lib/Drupal/Core/Render/Element/Email.php --- b/core/lib/Drupal/Core/Render/Element/Email.php +++ b/core/lib/Drupal/Core/Render/Element/Email.php @@ -7,18 +7,15 @@ namespace Drupal\Core\Render\Element; -use Drupal\Core\DependencyInjection\ContainerInjectionInterface; -use Symfony\Component\DependencyInjection\ContainerInterface; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Render\Element; -use Egulias\EmailValidator\EmailValidator; /** * Provides a form input element for entering an email address. * * @FormElement("email") */ -class Email extends FormElement implements ContainerInjectionInterface { +class Email extends FormElement { /** * Defines the max length for an email address @@ -33,32 +30,6 @@ const EMAIL_MAX_LENGTH = 254; /** - * The email validator. - * - * @var \Egulias\EmailValidator\EmailValidator - */ - protected static $emailValidator; - - /** - * Constructs a new Email. - * - * @param \Egulias\EmailValidator\EmailValidator $email_validator - * The email validator. - */ - public function __construct(EmailValidator $email_validator) { - $this->emailValidator = $email_validator; - } - - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container) { - return new static( - $container->get('email.validator') - ); - } - - /** * {@inheritdoc} */ public function getInfo() { @@ -93,7 +64,7 @@ $value = trim($element['#value']); $form_state->setValueForElement($element, $value); - if ($value !== '' && !self::$emailValidator->isValid($value)) { + if ($value !== '' && !\Drupal::service('email.validator')->isValid($value)) { $form_state->setError($element, t('The email address %mail is not valid.', array('%mail' => $value))); } }