function flat_comments_comment_links_alter in Flatcomments 8
Implements hook_comments_links_alter().
File
- ./
flat_comments.module, line 112 - Contains flat_comments.module.
Code
function flat_comments_comment_links_alter(array &$links, CommentInterface $entity, array &$context) {
// If there is not a "reply" link, no need to continue.
if (!isset($links['comment']['#links']['comment-reply'])) {
return;
}
$comment = $entity;
$entity = \Drupal::entityTypeManager()
->getStorage($comment
->getCommentedEntityTypeId())
->load($comment
->getCommentedEntityId());
$field_definition = \Drupal::service('entity_field.manager')
->getFieldDefinitions($entity
->getEntityTypeId(), $entity
->bundle());
$field_definition = $field_definition[$comment
->getFieldName()];
if ($field_definition
->getThirdPartySetting('flat_comments', 'remove_reply_link', FALSE)) {
unset($links['comment']['#links']['comment-reply']);
}
}