From 2b1d92fe2c9eddcf020c36af494161e0f5a8505a Mon Sep 17 00:00:00 2001 From: bach Date: Fri, 26 Nov 2021 10:39:57 +0100 Subject: [PATCH] added node type and id in body classes --- web/themes/custom/eql/eql.theme | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/web/themes/custom/eql/eql.theme b/web/themes/custom/eql/eql.theme index 79dd586..56fd962 100644 --- a/web/themes/custom/eql/eql.theme +++ b/web/themes/custom/eql/eql.theme @@ -9,6 +9,14 @@ // use Drupal\Core\Url; +function eql_preprocess_html(&$variables) { + $node = \Drupal::routeMatch()->getParameter('node'); + if ($node){ + $variables['attributes']['class'][] = 'node-type-' . $node->bundle(); + $variables['attributes']['class'][] = 'node-id-' . $node->id(); + } +} + function eql_preprocess_node(&$variables){ $node = &$variables['node']; $variables['attributes']['class'][] = 'node-type-' . $node->gettype();