소스 검색

added node type and id in body classes

bach 3 년 전
부모
커밋
2b1d92fe2c
1개의 변경된 파일8개의 추가작업 그리고 0개의 파일을 삭제
  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();