preprocess field typ de protegoniste

This commit is contained in:
2022-01-25 12:27:57 +01:00
parent a7ffdebc8a
commit bb95755b8b
3 changed files with 927 additions and 339 deletions
File diff suppressed because one or more lines are too long
+11 -11
View File
@@ -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;
}
}
}
//////////////////////////////////////////////////