소스 검색

preprocess field typ de protegoniste

ouidade 3 년 전
부모
커밋
bb95755b8b
3개의 변경된 파일893개의 추가작업 그리고 313개의 파일을 삭제
  1. 1 1
      .vscode/launch.json
  2. 881 301
      web/themes/custom/eql/css-prefixed/styles.css
  3. 11 11
      web/themes/custom/eql/eql.theme

+ 1 - 1
.vscode/launch.json

@@ -8,7 +8,7 @@
             "name": "Listen for Xdebug",
             "type": "php",
             "request": "launch",
-            "serverSourceRoot":"192.168.0.21"
+            "serverSourceRoot":"192.168.1.40",
             "port": 9001,
             "pathMappings": {
                 "/var/www/d9": "${workspaceFolder}"

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 881 - 301
web/themes/custom/eql/css-prefixed/styles.css


+ 11 - 11
web/themes/custom/eql/eql.theme

@@ -32,17 +32,17 @@ function eql_preprocess_node(&$variables){
   
 }
 
-/** /// fonctionne pour donner id au champs mais fais bugger les pages static "field unkown"
- * 
- * Implements hook_preprocess_field().
- */
-// function eql_preprocess_field(&$variables) {
-//   $node = \Drupal::routeMatch()->getParameter('node');
-//   if($node) {
-//     $type_protagoniste = $node->get('field_type_de_protagoniste')->getString();
-//     $variables['attributes']['class'][] = 'type-de-protagoniste-' . $type_protagoniste;
-//   }
-// }
+function eql_preprocess_field(&$variables) {
+  $node = \Drupal::routeMatch()->getParameter('node');
+
+  $field_name = &$variables['field_name'];
+  if($node) {
+    if ($field_name == 'field_type_de_protagoniste'){
+    $type_protagoniste = $node->get('field_type_de_protagoniste')->getString();
+    $variables['attributes']['class'][] = 'type-de-protagoniste-' . $type_protagoniste;
+    }    
+  }
+}
 
 //////////////////////////////////////////////////
 

이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.