diff --git a/core/modules/comment/src/Tests/CommentLinksTest.php b/core/modules/comment/src/Tests/CommentLinksTest.php index 68f9f0e..3cbec27 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/themes/bartik/bartik.theme b/core/themes/bartik/bartik.theme index 4f83a9e..caf6126 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 tag 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 8927db4..ed32a2c 100644 --- a/core/themes/bartik/templates/comment.html.twig +++ b/core/themes/bartik/templates/comment.html.twig @@ -106,9 +106,6 @@ {{ title }} {{ title_suffix }} {% endif %} - {{ content|without('links') }} - {% if content.links %} - - {% endif %} + {{ content }}