if ($owner->
getAccountName() !=
$author_name) { $this->context->
buildViolation($constraint->messageMatch
) ->
atPath('name'
) ->
addViolation();
} } // Anonymous account might be required - depending on field settings. We
// can't validate this without a valid commented entity, which will fail
// the validation elsewhere.
if ($owner_id === 0 &&
empty($author_name) &&
$entity->
getCommentedEntity() &&
$entity->
getFieldName() &&
$this->
getAnonymousContactDetailsSetting($entity) === CommentInterface::ANONYMOUS_MUST_CONTACT
) { $this->context->
buildViolation($constraint->messageRequired
) ->
atPath('name'
) ->
addViolation();
} } /**
* Gets the anonymous contact details setting from the comment.
*
* @param \Drupal\comment\CommentInterface $comment
* The entity.
*
* @return int
* The anonymous contact setting.
*/