From 2efd67941736bcb3281aefaf36130858b840e217 Mon Sep 17 00:00:00 2001 From: ouidade Date: Tue, 27 May 2025 23:36:23 +0200 Subject: [PATCH] url button tout voir dyamique --- web/themes/custom/eql/eql.theme | 3 +++ .../views-view-unformatted--base-de-donnees.html.twig | 10 ++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/web/themes/custom/eql/eql.theme b/web/themes/custom/eql/eql.theme index 9f091af..a3ad30e 100644 --- a/web/themes/custom/eql/eql.theme +++ b/web/themes/custom/eql/eql.theme @@ -223,6 +223,8 @@ function eql_preprocess_views_view_unformatted(array &$variables) { if ($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(); + $tid = $term->id(); // <-- on récupère l'ID + $label_ascii = $transliterator->transliterate($label); $type_class = 'type-' . Html::cleanCssIdentifier(strtolower($label_ascii)); @@ -230,6 +232,7 @@ function eql_preprocess_views_view_unformatted(array &$variables) { if (!isset($slides[$type_class])) { $slides[$type_class] = [ 'label' => $label, + 'tid' => $term->id(), 'rows' => [], ]; } diff --git a/web/themes/custom/eql/templates/views-view-unformatted--base-de-donnees.html.twig b/web/themes/custom/eql/templates/views-view-unformatted--base-de-donnees.html.twig index 5ed750f..6838f30 100644 --- a/web/themes/custom/eql/templates/views-view-unformatted--base-de-donnees.html.twig +++ b/web/themes/custom/eql/templates/views-view-unformatted--base-de-donnees.html.twig @@ -22,11 +22,17 @@ ] %} {% if grouped_rows is defined %} + {% set base_url = path('') ~ 'ressources' %} {% for type_class, group in grouped_rows %}

{{ group.label }}

- - + {% if group.tid is defined %} + + {% endif %}
{% for row in group.rows %}