瀏覽代碼

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}"

File diff suppressed because it is too large
+ 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;
+    }    
+  }
+}
 
 //////////////////////////////////////////////////
 

Some files were not shown because too many files changed in this diff