class CommentNameConstraint

Same name and namespace in other branches
  1. 11.x core/modules/comment/src/Plugin/Validation/Constraint/CommentNameConstraint.php \Drupal\comment\Plugin\Validation\Constraint\CommentNameConstraint
  2. 10 core/modules/comment/src/Plugin/Validation/Constraint/CommentNameConstraint.php \Drupal\comment\Plugin\Validation\Constraint\CommentNameConstraint
  3. 9 core/modules/comment/src/Plugin/Validation/Constraint/CommentNameConstraint.php \Drupal\comment\Plugin\Validation\Constraint\CommentNameConstraint
  4. 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

Expanded class hierarchy of CommentNameConstraint

File

core/modules/comment/src/Plugin/Validation/Constraint/CommentNameConstraint.php, line 13

Namespace

Drupal\comment\Plugin\Validation\Constraint
View 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.