class UserNameConstraint
Same name in other branches
- 9 core/modules/user/src/Plugin/Validation/Constraint/UserNameConstraint.php \Drupal\user\Plugin\Validation\Constraint\UserNameConstraint
- 10 core/modules/user/src/Plugin/Validation/Constraint/UserNameConstraint.php \Drupal\user\Plugin\Validation\Constraint\UserNameConstraint
- 11.x core/modules/user/src/Plugin/Validation/Constraint/UserNameConstraint.php \Drupal\user\Plugin\Validation\Constraint\UserNameConstraint
Checks if a value is a valid user name.
Plugin annotation
@Constraint(
id = "UserName",
label = @Translation("User name", context = "Validation"),
)
Hierarchy
- class \Drupal\user\Plugin\Validation\Constraint\UserNameConstraint extends \Symfony\Component\Validator\Constraint
Expanded class hierarchy of UserNameConstraint
1 file declares its use of UserNameConstraint
- MigrateEntityContentValidationTest.php in core/
modules/ migrate/ tests/ src/ Kernel/ MigrateEntityContentValidationTest.php
File
-
core/
modules/ user/ src/ Plugin/ Validation/ Constraint/ UserNameConstraint.php, line 15
Namespace
Drupal\user\Plugin\Validation\ConstraintView source
class UserNameConstraint extends Constraint {
public $emptyMessage = 'You must enter a username.';
public $spaceBeginMessage = 'The username cannot begin with a space.';
public $spaceEndMessage = 'The username cannot end with a space.';
public $multipleSpacesMessage = 'The username cannot contain multiple spaces in a row.';
public $illegalMessage = 'The username contains an illegal character.';
public $tooLongMessage = 'The username %name is too long: it must be %max characters or less.';
}
Members
Title Sort descending | Modifiers | Object type | Summary |
---|---|---|---|
UserNameConstraint::$emptyMessage | public | property | |
UserNameConstraint::$illegalMessage | public | property | |
UserNameConstraint::$multipleSpacesMessage | public | property | |
UserNameConstraint::$spaceBeginMessage | public | property | |
UserNameConstraint::$spaceEndMessage | public | property | |
UserNameConstraint::$tooLongMessage | public | property |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.