diff --git a/core/modules/node/node.module b/core/modules/node/node.module index 9d7c986..d1d33e3 100644 --- a/core/modules/node/node.module +++ b/core/modules/node/node.module @@ -1112,6 +1112,7 @@ function template_preprocess_node(&$variables) { $variables['teaser'] = $variables['view_mode'] == 'teaser'; $variables['node'] = $variables['elements']['#node']; $node = $variables['node']; + $variables['nid'] = $node->nid; $variables['date'] = format_date($node->created); // @todo Change 'name' to 'author' and also convert to a render array pending @@ -1122,7 +1123,8 @@ function template_preprocess_node(&$variables) { )); $uri = $node->uri(); - $variables['node_url'] = url($uri['path'], $uri['options']); + $variables['url'] = url($uri['path'], $uri['options']); + // @todo $variables['title']['label'] after http://drupal.org/node/2004966. $variables['label'] = check_plain($node->label()); $variables['page'] = $variables['view_mode'] == 'full' && node_is_page($node); @@ -1138,21 +1140,23 @@ function template_preprocess_node(&$variables) { // Display post information only on certain node types. if (variable_get('node_submitted_' . $node->type, TRUE)) { $variables['display_submitted'] = TRUE; + // @todo remove submitted once http://drupal.org/node/1927584 is resolved. $variables['submitted'] = t('Submitted by !username on !datetime', array('!username' => $variables['name'], '!datetime' => $variables['date'])); 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 // not be configured, so remember to always check the theme setting first. - $variables['user_picture'] = user_view($node->account, 'compact'); + $variables['author'] = user_view($node->account, 'compact'); } else { - $variables['user_picture'] = array(); + $variables['author'] = array(); } } else { $variables['display_submitted'] = FALSE; + // @todo remove submitted once http://drupal.org/node/1927584 is resolved. $variables['submitted'] = ''; - $variables['user_picture'] = ''; + $variables['author'] = ''; } if (!empty($node->links)) { @@ -1185,6 +1189,7 @@ function template_preprocess_node(&$variables) { $variables['theme_hook_suggestions'][] = 'node__' . $node->type; $variables['theme_hook_suggestions'][] = 'node__' . $node->nid; + // @todo these should be attributes on content instead. $variables['content_attributes']['class'][] = 'content'; } diff --git a/core/modules/node/templates/node.html.twig b/core/modules/node/templates/node.html.twig index 3e6714d..7268fbe 100644 --- a/core/modules/node/templates/node.html.twig +++ b/core/modules/node/templates/node.html.twig @@ -6,6 +6,7 @@ * Available variables: * - node: Full node entity. * - type: The type of the node, for example, "page" or "article". + * - nid: The node ID of the node. * - uid: The user ID of the node author. * - created: Formatted creation date. Preprocess functions can reformat it by * calling format_date() with the desired parameters on @@ -26,7 +27,7 @@ * or print a subset such as {{ content.field_example }}. Use * {% hide(content.field_example) %} to temporarily suppress the printing * of a given element. - * - user_picture: The node author's picture from user-picture.html.twig. + * - author: The node author, using the 'compact' view mode. * - date: Formatted creation date. Preprocess functions can reformat it by * calling format_date() with the desired parameters on * $variables['created']. @@ -78,19 +79,19 @@ * @ingroup themeable */ #} -
+
{{ title_prefix }} {% if not page %} - {{ label }} + {{ label }} {% endif %} {{ title_suffix }} {% if display_submitted %}
- {{ user_picture }} + {{ author }}
{% endif %} diff --git a/core/modules/rdf/rdf.module b/core/modules/rdf/rdf.module index aaea6bb..3e71a43 100644 --- a/core/modules/rdf/rdf.module +++ b/core/modules/rdf/rdf.module @@ -499,7 +499,7 @@ function rdf_preprocess_node(&$variables) { // URI of the resource described within the HTML element, while the @typeof // attribute indicates its RDF type (e.g., foaf:Document, sioc:Person, and so // on.) - $variables['attributes']['about'] = empty($variables['node_url']) ? NULL: $variables['node_url']; + $variables['attributes']['about'] = empty($variables['url']) ? NULL: $variables['url']; $variables['attributes']['typeof'] = empty($variables['node']->rdf_mapping['rdftype']) ? NULL : $variables['node']->rdf_mapping['rdftype']; // Adds RDFa markup to the title of the node. Because the RDFa markup is @@ -516,7 +516,7 @@ function rdf_preprocess_node(&$variables) { '#tag' => 'meta', '#attributes' => array( 'content' => $variables['label'], - 'about' => $variables['node_url'], + 'about' => $variables['url'], ), ); if (!empty($variables['node']->rdf_mapping['title']['predicates'])) { @@ -563,7 +563,7 @@ function rdf_preprocess_node(&$variables) { $element = array( '#tag' => 'meta', '#attributes' => array( - 'about' => $variables['node_url'], + 'about' => $variables['url'], 'property' => $variables['node']->rdf_mapping['comment_count']['predicates'], 'content' => $variables['node']->comment_count, 'datatype' => $variables['node']->rdf_mapping['comment_count']['datatype'], diff --git a/core/themes/bartik/templates/node.html.twig b/core/themes/bartik/templates/node.html.twig index 68a4a93..843602e 100644 --- a/core/themes/bartik/templates/node.html.twig +++ b/core/themes/bartik/templates/node.html.twig @@ -6,6 +6,7 @@ * Available variables: * - node: Full node entity. * - type: The type of the node, for example, "page" or "article". + * - nid: The node ID of the node. * - uid: The user ID of the node author. * - created: Formatted creation date. Preprocess functions can reformat it by * calling format_date() with the desired parameters on @@ -26,12 +27,12 @@ * or print a subset such as {{ content.field_example }}. Use * {% hide(content.field_example) %} to temporarily suppress the printing * of a given element. - * - user_picture: The node author's picture from user-picture.html.twig. + * - author: The node author, using the 'compact' view mode. * - date: Formatted creation date. Preprocess functions can reformat it by * calling format_date() with the desired parameters on * $variables['created']. * - name: Themed username of node author output from theme_username(). - * - node_url: Direct URL of the current node. + * - url: Direct URL of the current node. * - display_submitted: Whether submission information should be displayed. * - submitted: Submission information created from name and date during * template_preprocess_node(). @@ -78,38 +79,35 @@ * @ingroup themeable */ #} -
+
{{ title_prefix }} {% if not page %} - {{ label }} + {{ label }} {% endif %} {{ title_suffix }} {% if display_submitted %} {% endif %}
- {# We hide the comments and links now so that we can render them later. #} - {% hide(content.comments) %} - {% hide(content.links) %} {{ content }}
{% if content.links %} {% endif %} - {{ content.comments }} + {{ comments }}