diff --git a/core/modules/comment/src/Tests/CommentLinksTest.php b/core/modules/comment/src/Tests/CommentLinksTest.php index 8dc3b5b..2bede10 100644 --- a/core/modules/comment/src/Tests/CommentLinksTest.php +++ b/core/modules/comment/src/Tests/CommentLinksTest.php @@ -105,6 +105,20 @@ public function testCommentLinks() { $this->assertLink('Add new comment'); } + // Change weight to make links go before comment body. + entity_get_display('comment', 'comment', 'default') + ->setComponent('links', array('weight' => -100)) + ->save(); + $this->drupalGet($this->node->urlInfo()); + $this->assertTrue($this->cssSelect('article > div ul:first-child'), 'Links found before comment body.'); + + // Change weight to make links go after comment body. + entity_get_display('comment', 'comment', 'default') + ->setComponent('links', array('weight' => 100)) + ->save(); + $this->drupalGet($this->node->urlInfo()); + $this->assertTrue($this->cssSelect('article > div ul:last-child'), 'Links found after comment body.'); + // Make sure we can hide node links. entity_get_display('node', $this->node->bundle(), 'default') ->removeComponent('links') diff --git a/core/modules/comment/templates/comment.html.twig b/core/modules/comment/templates/comment.html.twig index 3a7d19b..eee30da 100644 --- a/core/modules/comment/templates/comment.html.twig +++ b/core/modules/comment/templates/comment.html.twig @@ -101,9 +101,6 @@ - {{ content|without('links') }} + {{ content }} - {% if content.links %} - {{ content.links }} - {% endif %} diff --git a/core/themes/bartik/bartik.theme b/core/themes/bartik/bartik.theme index 7148e84..0bd0498 100644 --- a/core/themes/bartik/bartik.theme +++ b/core/themes/bartik/bartik.theme @@ -103,6 +103,17 @@ function bartik_preprocess_block(&$variables) { } /** + * Implements hook_preprocess_HOOK() for comment.html.twig. + */ +function bartik_preprocess_comment(&$variables) { + if (isset($variables['content']['links'])) { + // Add NAV wrapper element for comment links. + $variables['content']['links']['#prefix'] = ''; + } +} + +/** * Implements hook_preprocess_HOOK() for menu.html.twig. */ function bartik_preprocess_menu(&$variables) { diff --git a/core/themes/bartik/templates/comment.html.twig b/core/themes/bartik/templates/comment.html.twig index 21cca3c..6c54204 100644 --- a/core/themes/bartik/templates/comment.html.twig +++ b/core/themes/bartik/templates/comment.html.twig @@ -104,12 +104,7 @@ {{ title_suffix }} {% endif %} - {{ content|without('links') }} + {{ content }} -
- {% if content.links %} - - {% endif %} -
diff --git a/core/themes/classy/templates/content/comment.html.twig b/core/themes/classy/templates/content/comment.html.twig index 97baf55..f48446d 100644 --- a/core/themes/classy/templates/content/comment.html.twig +++ b/core/themes/classy/templates/content/comment.html.twig @@ -107,9 +107,6 @@ - {{ content|without('links') }} + {{ content }} - {% if content.links %} - {{ content.links }} - {% endif %}