diff --git a/core/modules/locale/lib/Drupal/locale/Tests/LocaleContentTest.php b/core/modules/locale/lib/Drupal/locale/Tests/LocaleContentTest.php index 093da50..7ee8566 100644 --- a/core/modules/locale/lib/Drupal/locale/Tests/LocaleContentTest.php +++ b/core/modules/locale/lib/Drupal/locale/Tests/LocaleContentTest.php @@ -182,25 +182,25 @@ function testContentTypeDirLang() { // Check if English node does not have lang tag. $this->drupalGet('node/' . $nodes['en']->id()); - $pattern = '|id="node-' . $nodes['en']->id() . '"[^<>]*lang="en"|'; + $pattern = '|class="[^"]*node--' . $nodes['en']->id() . '[^"]*"[^<>]*lang="en"|'; $this->assertNoPattern($pattern, 'The lang tag has not been assigned to the English node.'); // Check if English node does not have dir tag. - $pattern = '|id="node-' . $nodes['en']->id() . '"[^<>]*dir="ltr"|'; + $pattern = '|class="[^"]*node--' . $nodes['en']->id() . '[^"]*"[^<>]*dir="ltr"|'; $this->assertNoPattern($pattern, 'The dir tag has not been assigned to the English node.'); // Check if Arabic node has lang="ar" & dir="rtl" tags. $this->drupalGet('node/' . $nodes['ar']->id()); - $pattern = '|id="node-' . $nodes['ar']->id() . '"[^<>]*lang="ar" dir="rtl"|'; + $pattern = '|class="[^"]*node--' . $nodes['ar']->id() . '[^"]*"[^<>]*lang="ar" dir="rtl"|'; $this->assertPattern($pattern, 'The lang and dir tags have been assigned correctly to the Arabic node.'); // Check if Spanish node has lang="es" tag. $this->drupalGet('node/' . $nodes['es']->id()); - $pattern = '|id="node-' . $nodes['es']->id() . '"[^<>]*lang="es"|'; + $pattern = '|class="[^"]*node--' . $nodes['es']->id() . '[^"]*"[^<>]*lang="es"|'; $this->assertPattern($pattern, 'The lang tag has been assigned correctly to the Spanish node.'); // Check if Spanish node does not have dir="ltr" tag. - $pattern = '|id="node-' . $nodes['es']->id() . '"[^<>]*lang="es" dir="ltr"|'; + $pattern = '|class="[^"]*node--' . $nodes['es']->id() . '[^"]*"[^<>]*lang="es" dir="ltr"|'; $this->assertNoPattern($pattern, 'The dir tag has not been assigned to the Spanish node.'); } diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeFieldMultilingualTestCase.php b/core/modules/node/lib/Drupal/node/Tests/NodeFieldMultilingualTestCase.php index 67b34e7..dc98089 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->id()); - $body = $this->xpath('//article[@id=:id]//div[@class=:class]/descendant::p', array( - ':id' => 'node-' . $node->id(), - ':class' => 'content', + $body = $this->xpath('//article[contains(concat(" ", normalize-space(@class), " "), :node-class)]//div[@class=:content-class]/descendant::p', array( + ':node-class' => 'node--' . $node->id(), + ':content-class' => 'node--content', )); $this->assertEqual(current($body), $node->body->value, 'Node body found.'); } diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeTitleTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeTitleTest.php index 9b503ff..02a0822 100644 --- a/core/modules/node/lib/Drupal/node/Tests/NodeTitleTest.php +++ b/core/modules/node/lib/Drupal/node/Tests/NodeTitleTest.php @@ -60,7 +60,7 @@ function testNodeTitle() { $this->assertEqual(current($this->xpath($xpath)), $node->label(), 'Node breadcrumb is equal to node title.', 'Node'); // Test node title in comment preview. - $this->assertEqual(current($this->xpath('//article[@id=:id]/h2/a/span', array(':id' => 'node-' . $node->id()))), $node->label(), 'Node preview title is equal to node title.', 'Node'); + $this->assertEqual(current($this->xpath('//article[contains(concat(" ", normalize-space(@class), " "), :node-class)]/h2/a/span', array(':node-class' => 'node--' . $node->id() ))), $node->label(), 'Node preview title is equal to node title.', 'Node'); // Test node title is clickable on teaser list (/node). $this->drupalGet('node'); diff --git a/core/modules/node/node.module b/core/modules/node/node.module index b05fc2c..983683a 100644 --- a/core/modules/node/node.module +++ b/core/modules/node/node.module @@ -644,11 +644,9 @@ function template_preprocess_node(&$variables) { '#link_options' => array('attributes' => array('rel' => 'author')), ); $variables['name'] = drupal_render($username); + $variables['url'] = $node->url(); - $variables['node_url'] = $node->url('canonical', array( - 'language' => $node->language(), - )); - $variables['label'] = $variables['elements']['title']; + $variables['label'] = isset($variables['elements']['title']) ? $variables['elements']['title'] : ''; unset($variables['elements']['title']); $variables['page'] = $variables['view_mode'] == 'full' && node_is_page($node); @@ -669,15 +667,15 @@ function template_preprocess_node(&$variables) { // 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->getOwner(), 'compact'); + $variables['author'] = user_view($node->getOwner(), 'compact'); } else { - $variables['user_picture'] = array(); + $variables['author'] = array(); } } else { $variables['submitted'] = ''; - $variables['user_picture'] = ''; + $variables['author'] = ''; } // Add article ARIA role. @@ -701,7 +699,7 @@ function template_preprocess_node(&$variables) { if (isset($variables['preview'])) { $variables['attributes']['class'][] = 'preview'; } - $variables['content_attributes']['class'][] = 'content'; + $variables['content_attributes']['class'][] = 'node--content'; } /** diff --git a/core/modules/node/templates/node.html.twig b/core/modules/node/templates/node.html.twig index 5bf5ad9..164e4dc 100644 --- a/core/modules/node/templates/node.html.twig +++ b/core/modules/node/templates/node.html.twig @@ -20,13 +20,14 @@ * or print a subset such as {{ content.field_example }}. Use * {{ content|without('field_example') %} to temporarily suppress the printing * of a given child 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. + * template_preprocess_node(). * - submitted: Submission information created from name and date during * template_preprocess_node(). * - attributes: HTML attributes for the containing element. @@ -75,20 +76,25 @@ * @ingroup themeable */ #} -
+
{{ title_prefix }} {% if not page %} - {{ label }} + {{ label }} {% endif %} {{ title_suffix }} - {% if display_submitted %} + {% if content.links or author or display_submitted %}
- {{ user_picture }} - + {{ author }} + {% if display_submitted %} + + {% endif %} + {{ content.links }}
{% endif %} @@ -96,6 +102,6 @@ {{ content|without('links') }} - {{ content.links }} + {{ links }}
diff --git a/core/modules/rdf/rdf.module b/core/modules/rdf/rdf.module index bf8c60e..e84e77c 100644 --- a/core/modules/rdf/rdf.module +++ b/core/modules/rdf/rdf.module @@ -278,7 +278,7 @@ function rdf_preprocess_node(&$variables) { $bundle = $variables['node']->bundle(); $mapping = rdf_get_mapping('node', $bundle); $bundle_mapping = $mapping->getPreparedBundleMapping('node', $bundle); - $variables['attributes']['about'] = empty($variables['node_url']) ? NULL: $variables['node_url']; + $variables['attributes']['about'] = empty($variables['url']) ? NULL: $variables['url']; $variables['attributes']['typeof'] = empty($bundle_mapping['types']) ? NULL : $bundle_mapping['types']; // Adds RDFa markup for the node title as metadata because wrapping the title diff --git a/core/themes/bartik/templates/node.html.twig b/core/themes/bartik/templates/node.html.twig index 6afb107..e3f8164 100644 --- a/core/themes/bartik/templates/node.html.twig +++ b/core/themes/bartik/templates/node.html.twig @@ -20,12 +20,12 @@ * or print a subset such as {{ content.field_example }}. Use * {{ content|without('field_example') }} to exclude the printing of a * given child 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(). @@ -69,31 +69,30 @@ * @see template_preprocess_node() */ #} -
+
{{ title_prefix }} {% if not page %} - {{ label }} + {{ label }} {% endif %} {{ title_suffix }} - - {% if display_submitted %} - - {% endif %}
{{ content|without('links') }}
- {% if content.links %} -