class EmailConstraint

Same name in other branches
  1. 8.9.x core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/EmailConstraint.php \Drupal\Core\Validation\Plugin\Validation\Constraint\EmailConstraint
  2. 10 core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/EmailConstraint.php \Drupal\Core\Validation\Plugin\Validation\Constraint\EmailConstraint
  3. 11.x core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/EmailConstraint.php \Drupal\Core\Validation\Plugin\Validation\Constraint\EmailConstraint

Count constraint.

Overrides the symfony constraint to use the strict setting.

Plugin annotation


@Constraint(
  id = "Email",
  label = @Translation("Email", context = "Validation")
)

Hierarchy

  • class \Drupal\Core\Validation\Plugin\Validation\Constraint\EmailConstraint extends \Symfony\Component\Validator\Constraints\Email

Expanded class hierarchy of EmailConstraint

File

core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/EmailConstraint.php, line 17

Namespace

Drupal\Core\Validation\Plugin\Validation\Constraint
View source
class EmailConstraint extends Email {
    
    /**
     * {@inheritdoc}
     */
    public function __construct($options = []) {
        $options += [
            'mode' => 'strict',
        ];
        parent::__construct($options);
    }
    
    /**
     * {@inheritdoc}
     */
    public function validatedBy() {
        return '\\Symfony\\Component\\Validator\\Constraints\\EmailValidator';
    }

}

Members

Title Sort descending Modifiers Object type Summary
EmailConstraint::validatedBy public function
EmailConstraint::__construct public function

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.