diff --git a/core/modules/comment/comment.module b/core/modules/comment/comment.module index b2d0190..ac7e774 100644 --- a/core/modules/comment/comment.module +++ b/core/modules/comment/comment.module @@ -650,7 +650,7 @@ function comment_node_view(EntityInterface $node, EntityDisplay $display, $view_ } } - $node->content['links']['comment'] = array( + $node->links['comment'] = array( '#theme' => 'links__node__comment', '#links' => $links, '#attributes' => array('class' => array('links', 'inline')), @@ -661,7 +661,7 @@ function comment_node_view(EntityInterface $node, EntityDisplay $display, $view_ // appended to other nodes shown on the page, for example a node_reference // displayed in 'full' view mode within another node. if ($node->comment && $view_mode == 'full' && node_is_page($node) && empty($node->in_preview)) { - $node->content['comments'] = comment_node_page_additions($node); + $node->comments = comment_node_page_additions($node); } } } @@ -1526,6 +1526,13 @@ function comment_preview(Comment $comment) { } /** + * Implements hook_preprocess_HOOK() for node.html.twig. + */ +function comment_preprocess_node(&$variables) { + $variables['comments'] = $variables['node']->comments; +} + +/** * Implements hook_preprocess_HOOK() for block.html.twig. */ function comment_preprocess_block(&$variables) { diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeFieldMultilingualTestCase.php b/core/modules/node/lib/Drupal/node/Tests/NodeFieldMultilingualTestCase.php index 0206460..cd8add8 100644 --- a/core/modules/node/lib/Drupal/node/Tests/NodeFieldMultilingualTestCase.php +++ b/core/modules/node/lib/Drupal/node/Tests/NodeFieldMultilingualTestCase.php @@ -132,9 +132,9 @@ function testMultilingualDisplaySettings() { // Check if node body is showed. $this->drupalGet("node/$node->nid"); - $body = $this->xpath('//article[@id=:id]//div[@class=:class]/descendant::p', array( - ':id' => 'node-' . $node->nid, - ':class' => 'content', + $body = $this->xpath('//article[@class=:node-class]//div[@class=:content-class]/descendant::p', array( + ':node-class' => 'node-.' . $node->nid, + ':content-class' => 'content', )); $this->assertEqual(current($body), $node->body['en'][0]['value'], 'Node body found.'); } diff --git a/core/modules/node/node.module b/core/modules/node/node.module index 6d7b1c9..055ad6d 100644 --- a/core/modules/node/node.module +++ b/core/modules/node/node.module @@ -1154,6 +1154,10 @@ function template_preprocess_node(&$variables) { $variables['user_picture'] = ''; } + if (!empty($node->links)) { + $variables['links'] = $node->links; + } + // Add article ARIA role. $variables['attributes']['role'] = 'article'; diff --git a/core/modules/node/templates/node.html.twig b/core/modules/node/templates/node.html.twig index d28b880..3e6714d 100644 --- a/core/modules/node/templates/node.html.twig +++ b/core/modules/node/templates/node.html.twig @@ -75,14 +75,10 @@ * @see template_preprocess() * @see template_preprocess_node() * - * @todo Remove the id attribute (or make it a class), because if that gets - * rendered twice on a page this is invalid CSS for example: two lists - * in different view modes. - * * @ingroup themeable */ #} -
+
{{ title_prefix }} {% if not page %} @@ -95,18 +91,15 @@ {% if display_submitted %}
{{ user_picture }} - +
{% endif %} - {# We hide the comments and links now so that we can render them later. #} - {% hide(content.comments) %} - {% hide(content.links) %} {{ content }} - {{ content.links }} - {{ content.comments }} + {{ links }} + {{ comments }}