diff --git a/core/modules/node/node.module b/core/modules/node/node.module index db9d7df..9020be8 100644 --- a/core/modules/node/node.module +++ b/core/modules/node/node.module @@ -597,12 +597,6 @@ function template_preprocess_node(&$variables) { // - The node is in preview and view mode is either 'full' or 'default'. $variables['page'] = ($variables['view_mode'] == 'full' && (node_is_page($node)) || (isset($node->in_preview) && in_array($node->preview_view_mode, array('full', 'default')))); - // Helpful $content variable for templates. - $variables += array('content' => array()); - foreach (Element::children($variables['elements']) as $key) { - $variables['content'][$key] = $variables['elements'][$key]; - } - // Display post information only on certain node types. $node_type = $node->type->entity; // Used by RDF to add attributes around the author and date submitted. @@ -610,9 +604,7 @@ function template_preprocess_node(&$variables) { if ($variables['display_submitted']) { $variables['author_attributes'] = new Attribute(); $variables['date'] = drupal_render($variables['elements']['created']); - unset($variables['elements']['created']); $variables['author_name'] = drupal_render($variables['elements']['uid']); - unset($variables['elements']['uid']); if (theme_get_setting('features.node_user_picture')) { // To change user picture settings (e.g. image style), edit the 'compact' // view mode on the User entity. Note that the 'compact' view mode might @@ -620,6 +612,14 @@ function template_preprocess_node(&$variables) { $variables['author_picture'] = user_view($node->getOwner(), 'compact'); } } + unset($variables['elements']['uid']); + unset($variables['elements']['created']); + + // Helpful $content variable for templates. + $variables += array('content' => array()); + foreach (Element::children($variables['elements']) as $key) { + $variables['content'][$key] = $variables['elements'][$key]; + } // 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 5080da2..bb09b3e 100644 --- a/core/modules/node/templates/node.html.twig +++ b/core/modules/node/templates/node.html.twig @@ -21,7 +21,7 @@ * - display_submitted: Whether submission information should be displayed. * If display_submitted is set, additional variables are prepared: * - author_picture: The node author user entity, rendered using the "compact" - * view mode.. + * view mode. * - date: Themed creation date field. * - author_name: Themed author name field. * - author_attributes: Same as attributes, except applied to the author of diff --git a/core/themes/bartik/bartik.theme b/core/themes/bartik/bartik.theme index 60f9a34..90c1d82 100644 --- a/core/themes/bartik/bartik.theme +++ b/core/themes/bartik/bartik.theme @@ -101,7 +101,7 @@ function bartik_preprocess_maintenance_page(&$variables) { function bartik_preprocess_node(&$variables) { // Remove the "Add new comment" link on teasers or when the comment form is // displayed on the page. - if ($variables['teaser'] || !empty($variables['content']['comments']['comment_form'])) { + if ($variables['view_mode'] == 'teaser' || !empty($variables['content']['comments']['comment_form'])) { unset($variables['content']['links']['comment']['#links']['comment-add']); } } diff --git a/core/themes/bartik/templates/node.html.twig b/core/themes/bartik/templates/node.html.twig index 3150206..acc85ba 100644 --- a/core/themes/bartik/templates/node.html.twig +++ b/core/themes/bartik/templates/node.html.twig @@ -1,7 +1,7 @@ {# /** * @file - * Bartik's theme implementation to display a node. + * Default theme implementation to display a node. * * Available variables: * - node: Full node entity. @@ -16,13 +16,16 @@ * or print a subset such as {{ content.field_example }}. Use * {{ content|without('field_example') }} to temporarily suppress the printing * of a given child element. - * - author_picture: The node author user entity, rendered using the "compact" - * view mode. * - metadata: Metadata for this node. - * - date: Themed creation date field. - * - author_name: Themed author name field. * - url: Direct URL of the current node. * - display_submitted: Whether submission information should be displayed. + * If display_submitted is set, additional variables are prepared: + * - author_picture: The node author user entity, rendered using the "compact" + * view mode. + * - date: Themed creation date field. + * - author_name: Themed author name field. + * - author_attributes: Same as attributes, except applied to the author of + * the node that appears in the template. * - attributes: HTML attributes for the containing element. * The attributes.class element may contain one or more of the following * classes: @@ -43,17 +46,12 @@ * tag that appears in the template. * - content_attributes: Same as attributes, except applied to the main * content tag that appears in the template. - * - author_attributes: Same as attributes, except applied to the author of - * the node tag that appears in the template. * - title_prefix: Additional output populated by modules, intended to be * displayed in front of the main title tag that appears in the template. * - title_suffix: Additional output populated by modules, intended to be * displayed after the main title tag that appears in the template. * - view_mode: View mode; for example, "teaser" or "full". - * - teaser: Flag for the teaser state. Will be true if view_mode is 'teaser'. * - page: Flag for the full page state. Will be true if view_mode is 'full'. - * - readmore: Flag for more state. Will be true if the teaser content of the - * node cannot hold the main body content. * - is_front: Flag for front. Will be true when presented on the front page. * - logged_in: Flag for authenticated user status. Will be true when the * current user is a logged-in member.