'entity_type' =>
$entity->
getEntityTypeId(),
'entity' =>
$entity->
id(),
'field_name' =>
$field_name,
]);
} else { $links['comment-add'
] +=
['url' =>
$entity->
toUrl()];
} } elseif ($this->currentUser->
isAnonymous()) { $links['comment-forbidden'
] =
[ 'title' =>
$this->commentManager->
forbiddenMessage($entity,
$field_name),
];
} } } else { // Entity in other view modes: add a "post comment" link if the user
// is allowed to post comments and if this entity is allowing new
// comments.
if ($commenting_status == CommentItemInterface::OPEN
) { $comment_form_location =
$field_definition->
getSetting('form_location'
);
if ($this->currentUser->
hasPermission('post comments'
)) {