class CommentNameConstraint
Same name and namespace in other branches
- 11.x core/modules/comment/src/Plugin/Validation/Constraint/CommentNameConstraint.php \Drupal\comment\Plugin\Validation\Constraint\CommentNameConstraint
- 10 core/modules/comment/src/Plugin/Validation/Constraint/CommentNameConstraint.php \Drupal\comment\Plugin\Validation\Constraint\CommentNameConstraint
- 9 core/modules/comment/src/Plugin/Validation/Constraint/CommentNameConstraint.php \Drupal\comment\Plugin\Validation\Constraint\CommentNameConstraint
- 8.9.x core/modules/comment/src/Plugin/Validation/Constraint/CommentNameConstraint.php \Drupal\comment\Plugin\Validation\Constraint\CommentNameConstraint
Supports validating comment author names.
Attributes
#[Constraint(id: 'CommentName', label: new TranslatableMarkup('Comment author name', [], [
'context' => 'Validation',
]), type: 'entity:comment')]
Hierarchy
- class \Drupal\Core\Entity\Plugin\Validation\Constraint\CompositeConstraintBase extends \Symfony\Component\Validator\Constraint
- class \Drupal\comment\Plugin\Validation\Constraint\CommentNameConstraint extends \Drupal\Core\Entity\Plugin\Validation\Constraint\CompositeConstraintBase
Expanded class hierarchy of CommentNameConstraint
File
-
core/
modules/ comment/ src/ Plugin/ Validation/ Constraint/ CommentNameConstraint.php, line 13
Namespace
Drupal\comment\Plugin\Validation\ConstraintView source
class CommentNameConstraint extends CompositeConstraintBase {
public function __construct(mixed $options = NULL, public $messageNameTaken = 'The name you used (%name) belongs to a registered user.', public $messageRequired = 'You have to specify a valid author.', public $messageMatch = 'The specified author name does not match the comment author.', ?array $groups = NULL, mixed $payload = NULL) {
parent::__construct($options, $groups, $payload);
}
/**
* {@inheritdoc}
*/
public function coversFields() {
return [
'name',
'uid',
];
}
}
Members
| Title Sort descending | Modifiers | Object type | Summary | Overriden Title |
|---|---|---|---|---|
| CommentNameConstraint::coversFields | public | function | An array of entity fields which should be passed to the validator. | Overrides CompositeConstraintBase::coversFields |
| CommentNameConstraint::__construct | public | function | #[HasNamedArguments] |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.