Explorar el Código

added node type and id in body classes

bach hace 3 años
padre
commit
2b1d92fe2c
Se han modificado 1 ficheros con 8 adiciones y 0 borrados
  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();