function CommentNameConstraintValidator::getAnonymousContactDetailsSetting

Same name in other branches
  1. 9 core/modules/comment/src/Plugin/Validation/Constraint/CommentNameConstraintValidator.php \Drupal\comment\Plugin\Validation\Constraint\CommentNameConstraintValidator::getAnonymousContactDetailsSetting()
  2. 10 core/modules/comment/src/Plugin/Validation/Constraint/CommentNameConstraintValidator.php \Drupal\comment\Plugin\Validation\Constraint\CommentNameConstraintValidator::getAnonymousContactDetailsSetting()
  3. 11.x core/modules/comment/src/Plugin/Validation/Constraint/CommentNameConstraintValidator.php \Drupal\comment\Plugin\Validation\Constraint\CommentNameConstraintValidator::getAnonymousContactDetailsSetting()

Gets the anonymous contact details setting from the comment.

Parameters

\Drupal\comment\CommentInterface $comment: The entity.

Return value

int The anonymous contact setting.

1 call to CommentNameConstraintValidator::getAnonymousContactDetailsSetting()
CommentNameConstraintValidator::validate in core/modules/comment/src/Plugin/Validation/Constraint/CommentNameConstraintValidator.php

File

core/modules/comment/src/Plugin/Validation/Constraint/CommentNameConstraintValidator.php, line 95

Class

CommentNameConstraintValidator
Validates the CommentName constraint.

Namespace

Drupal\comment\Plugin\Validation\Constraint

Code

protected function getAnonymousContactDetailsSetting(CommentInterface $comment) {
    return $comment->getCommentedEntity()
        ->get($comment->getFieldName())
        ->getFieldDefinition()
        ->getSetting('anonymous');
}

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