class article

This commit is contained in:
2025-05-23 09:50:35 +02:00
parent 9f1df3d54a
commit 09bf2b4c8b
4 changed files with 12 additions and 9 deletions
+8 -7
View File
@@ -24,6 +24,7 @@ function eql_preprocess_html(&$variables) {
function eql_preprocess_node(&$variables){
$node = &$variables['node'];
$variables['attributes']['class'][] = 'node-type-' . $node->gettype();
if($node->gettype() == "actualite") {
$actu_type = $node->get('field_actu_type')->getString();
$variables['attributes']['class'][] = 'actu-type-' . $actu_type;
@@ -42,13 +43,13 @@ function eql_preprocess_node(&$variables){
// $variables['attributes']['class'][] = 'type-de-ressource-' . Html::cleanCssIdentifier($type_de_ressource_name);
// }
// }
// if ($node->getType() === 'ressource' && $node->hasField('field_type_de_ressource') && !$node->get('field_type_de_ressource')->isEmpty()) {
// foreach ($node->get('field_type_de_ressource')->referencedEntities() as $term) {
// $label = $term->label(); // ex: "Presse"
// $class = 'type-' . Html::cleanCssIdentifier(strtolower($label));
// $variables['attributes']['class'][] = $class;
// }
// }
if ($node->getType() === 'ressource' && $node->hasField('field_type_de_ressource') && !$node->get('field_type_de_ressource')->isEmpty()) {
foreach ($node->get('field_type_de_ressource')->referencedEntities() as $term) {
$label = $term->label(); // ex: "Presse"
$class = 'type-' . Html::cleanCssIdentifier(strtolower($label));
$variables['attributes']['class'][] = $class;
}
}
}
function eql_preprocess_field(&$variables) {