function EmailItem::getConstraints
Same name in other branches
- 9 core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EmailItem.php \Drupal\Core\Field\Plugin\Field\FieldType\EmailItem::getConstraints()
- 10 core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EmailItem.php \Drupal\Core\Field\Plugin\Field\FieldType\EmailItem::getConstraints()
- 11.x core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EmailItem.php \Drupal\Core\Field\Plugin\Field\FieldType\EmailItem::getConstraints()
Overrides TypedData::getConstraints
File
-
core/
lib/ Drupal/ Core/ Field/ Plugin/ Field/ FieldType/ EmailItem.php, line 53
Class
- EmailItem
- Defines the 'email' field type.
Namespace
Drupal\Core\Field\Plugin\Field\FieldTypeCode
public function getConstraints() {
$constraint_manager = \Drupal::typedDataManager()->getValidationConstraintManager();
$constraints = parent::getConstraints();
$constraints[] = $constraint_manager->create('ComplexData', [
'value' => [
'Length' => [
'max' => Email::EMAIL_MAX_LENGTH,
'maxMessage' => t('%name: the email address can not be longer than @max characters.', [
'%name' => $this->getFieldDefinition()
->getLabel(),
'@max' => Email::EMAIL_MAX_LENGTH,
]),
],
],
]);
return $constraints;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.