diff --git a/core/modules/node/node.module b/core/modules/node/node.module index 32d3295..fa3bfe2 100644 --- a/core/modules/node/node.module +++ b/core/modules/node/node.module @@ -677,22 +677,21 @@ function template_preprocess_node(&$variables) { $variables['attributes']['role'] = 'article'; // Gather node classes. - $variables['attributes']['class'][] = 'node'; - $variables['attributes']['class'][] = drupal_html_class('node--type-' . $node->bundle()); + $variables['attributes']['class'][] = ''; + + $variables['node_type'] = $node->bundle(); + $variables['view_mode'] = drupal_html_class($variables['view_mode']); if ($node->isPromoted()) { - $variables['attributes']['class'][] = 'node--promoted'; + $variables['node_promoted'] = TRUE; } if ($node->isSticky()) { - $variables['attributes']['class'][] = 'node--sticky'; + $variables['node_sticky'] = TRUE; } if (!$node->isPublished()) { - $variables['attributes']['class'][] = 'node--unpublished'; - } - if ($variables['view_mode']) { - $variables['attributes']['class'][] = drupal_html_class('node--view-mode-' . $variables['view_mode']); + $variables['node_unpublished'] = TRUE; } if (isset($variables['preview'])) { - $variables['attributes']['class'][] = 'node--preview'; + $variables['preview'] = TRUE; } } diff --git a/core/modules/node/templates/node.html.twig b/core/modules/node/templates/node.html.twig index c80eecb..74b7869 100644 --- a/core/modules/node/templates/node.html.twig +++ b/core/modules/node/templates/node.html.twig @@ -77,7 +77,9 @@ * @ingroup themeable */ #} - + +{% set classes %} node node--type-{{ node_type }} {% if node_promoted %} node--promoted {% endif %} {% if node_sticky %} node--sticky {% endif %} {% if node_unpublished %} node--unpublished {% endif %} {% if preview %} node--preview {% endif %} node--view-mode-{{ view_mode }} {{ attributes.class }} {% endset %} +
{{ title_prefix }} {% if not page %} diff --git a/core/themes/bartik/templates/node.html.twig b/core/themes/bartik/templates/node.html.twig index d45b0f0..a4a1d15 100644 --- a/core/themes/bartik/templates/node.html.twig +++ b/core/themes/bartik/templates/node.html.twig @@ -71,7 +71,8 @@ * @see template_preprocess_node() */ #} -
+{% set classes %} node node--type-{{ node_type }} {% if node_promoted %} node--promoted {% endif %} {% if node_sticky %} node--sticky {% endif %} {% if node_unpublished %} node--unpublished {% endif %} {% if preview %} node--preview {% endif %} node--view-mode-{{ view_mode }} {{ attributes.class }} {% endset %} +
{{ title_prefix }}