diff --git a/core/modules/node/node.module b/core/modules/node/node.module index ff88125..7492bb1 100644 --- a/core/modules/node/node.module +++ b/core/modules/node/node.module @@ -654,24 +654,8 @@ function template_preprocess_node(&$variables) { // Add article ARIA role. $variables['attributes']['role'] = 'article'; - // Gather node classes. - $variables['attributes']['class'][] = 'node'; - $variables['attributes']['class'][] = drupal_html_class('node--type-' . $node->bundle()); - if ($node->isPromoted()) { - $variables['attributes']['class'][] = 'node--promoted'; - } - if ($node->isSticky()) { - $variables['attributes']['class'][] = 'node--sticky'; - } - if (!$node->isPublished()) { - $variables['attributes']['class'][] = 'node--unpublished'; - } - if ($variables['view_mode']) { - $variables['attributes']['class'][] = drupal_html_class('node--view-mode-' . $variables['view_mode']); - } - if (isset($variables['preview'])) { - $variables['attributes']['class'][] = 'node--preview'; - } + // Add an empty class for modules + $variables['attributes']['class'] = ''; } /** diff --git a/core/modules/node/templates/node.html.twig b/core/modules/node/templates/node.html.twig index c80eecb..ba800fe 100644 --- a/core/modules/node/templates/node.html.twig +++ b/core/modules/node/templates/node.html.twig @@ -77,7 +77,20 @@ * @ingroup themeable */ #} - + +{% + set add_classes = [ + 'node', + 'node--type-' ~ node.bundle|class, + node.promoted ? 'node--promoted', + node.sticky ? 'node--sticky', + not node.published ? 'node--unpublished', + 'node--view-mode-' ~ view_mode|class, + preview ? ' node--preview' + ] +%} + + {{ 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..543469d 100644 --- a/core/themes/bartik/templates/node.html.twig +++ b/core/themes/bartik/templates/node.html.twig @@ -71,7 +71,20 @@ * @see template_preprocess_node() */ #} -
+{% + set add_classes = [ + 'node', + 'node--type-' ~ node.bundle|class, + node.promoted ? 'node--promoted', + node.sticky ? 'node--sticky', + not node.published ? 'node--unpublished', + 'node--view-mode-' ~ view_mode|class, + preview ? ' node--preview', + 'clearfix' + ] +%} + +
{{ title_prefix }}