Quellcode durchsuchen

added node type and id in body classes

bach vor 3 Jahren
Ursprung
Commit
2b1d92fe2c
1 geänderte Dateien mit 8 neuen und 0 gelöschten Zeilen
  1. 8 0
      web/themes/custom/eql/eql.theme

+ 8 - 0
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();