added node type and id in body classes

This commit is contained in:
2021-11-26 10:39:57 +01:00
parent 74a6143096
commit 2b1d92fe2c
+8
View File
@@ -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();