소스 검색

debug node-id

ouidade 2 주 전
부모
커밋
4e47d9fe40
1개의 변경된 파일4개의 추가작업 그리고 0개의 파일을 삭제
  1. 4 0
      web/themes/custom/eql/eql.theme

+ 4 - 0
web/themes/custom/eql/eql.theme

@@ -14,6 +14,10 @@ use Drupal\Core\Template\Attribute;
 
 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();
+  }
   if ($node instanceof NodeInterface) {
     $variables['attributes']['class'][] = 'node-type-' . $node->bundle();
     $variables['attributes']['class'][] = 'node-id-' . $node->id();