diff --git a/core/modules/comment/comment.module b/core/modules/comment/comment.module index 5ce3ba9..d06216b 100644 --- a/core/modules/comment/comment.module +++ b/core/modules/comment/comment.module @@ -121,6 +121,12 @@ function comment_entity_extra_field_info() { ), ), ); + $extra['node'][$comment_type->id()]['display']['links'] = array( + 'label' => t('Links'), + 'description' => t('Comment operation links'), + 'weight' => 100, + 'visible' => TRUE, + ); } return $return; diff --git a/core/modules/comment/src/CommentViewBuilder.php b/core/modules/comment/src/CommentViewBuilder.php index 6a4760b..51e9d94 100644 --- a/core/modules/comment/src/CommentViewBuilder.php +++ b/core/modules/comment/src/CommentViewBuilder.php @@ -111,24 +111,28 @@ public function buildComponents(array &$build, array $entities, array $displays, } $build[$id]['#entity'] = $entity; $build[$id]['#theme'] = 'comment__' . $entity->getFieldName() . '__' . $commented_entity->bundle(); - $callback = '\Drupal\comment\CommentViewBuilder::renderLinks'; - $context = array( - 'comment_entity_id' => $entity->id(), - 'view_mode' => $view_mode, - 'langcode' => $langcode, - 'commented_entity_type' => $commented_entity->getEntityTypeId(), - 'commented_entity_id' => $commented_entity->id(), - 'in_preview' => !empty($entity->in_preview), - ); - $placeholder = drupal_render_cache_generate_placeholder($callback, $context); - $build[$id]['links'] = array( - '#post_render_cache' => array( - $callback => array( - $context, + + $display = $displays[$commented_entity->bundle()]; + if ($display->getComponent('links')) { + $callback = '\Drupal\comment\CommentViewBuilder::renderLinks'; + $context = array( + 'comment_entity_id' => $entity->id(), + 'view_mode' => $view_mode, + 'langcode' => $langcode, + 'commented_entity_type' => $commented_entity->getEntityTypeId(), + 'commented_entity_id' => $commented_entity->id(), + 'in_preview' => !empty($entity->in_preview), + ); + $placeholder = drupal_render_cache_generate_placeholder($callback, $context); + $build[$id]['links'] = array( + '#post_render_cache' => array( + $callback => array( + $context, + ), ), - ), - '#markup' => $placeholder, - ); + '#markup' => $placeholder, + ); + } $account = comment_prepare_author($entity); if (\Drupal::config('user.settings')->get('signatures') && $account->getSignature()) { diff --git a/core/modules/comment/templates/comment.html.twig b/core/modules/comment/templates/comment.html.twig index 7ffb7c0..575510f 100644 --- a/core/modules/comment/templates/comment.html.twig +++ b/core/modules/comment/templates/comment.html.twig @@ -107,5 +107,7 @@ {% endif %} - {{ content.links }} + {% if content.links %} + {{ content.links }} + {% endif %} diff --git a/core/modules/node/config/install/views.view.frontpage.yml b/core/modules/node/config/install/views.view.frontpage.yml index 9294252..6b41ca9 100644 --- a/core/modules/node/config/install/views.view.frontpage.yml +++ b/core/modules/node/config/install/views.view.frontpage.yml @@ -283,7 +283,6 @@ display: options: relationship: none view_mode: rss - links: false provider: views field_langcode: '***CURRENT_LANGUAGE***' field_langcode_add_to_query: null diff --git a/core/modules/taxonomy/config/install/views.view.taxonomy_term.yml b/core/modules/taxonomy/config/install/views.view.taxonomy_term.yml index 7c639c0..db3de99 100644 --- a/core/modules/taxonomy/config/install/views.view.taxonomy_term.yml +++ b/core/modules/taxonomy/config/install/views.view.taxonomy_term.yml @@ -237,7 +237,6 @@ display: options: relationship: none view_mode: default - links: false provider: views label: 'Taxonomy term' module: taxonomy diff --git a/core/themes/bartik/templates/comment.html.twig b/core/themes/bartik/templates/comment.html.twig index c00a9c5..7a22fc0 100644 --- a/core/themes/bartik/templates/comment.html.twig +++ b/core/themes/bartik/templates/comment.html.twig @@ -119,9 +119,11 @@ {% endif %} - + {% if content.links %} + + {% endif %}