url button tout voir dyamique
This commit is contained in:
@@ -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()) {
|
if ($node->hasField('field_type_de_ressource') && !$node->get('field_type_de_ressource')->isEmpty()) {
|
||||||
foreach ($node->get('field_type_de_ressource')->referencedEntities() as $term) {
|
foreach ($node->get('field_type_de_ressource')->referencedEntities() as $term) {
|
||||||
$label = $term->label();
|
$label = $term->label();
|
||||||
|
$tid = $term->id(); // <-- on récupère l'ID
|
||||||
|
|
||||||
$label_ascii = $transliterator->transliterate($label);
|
$label_ascii = $transliterator->transliterate($label);
|
||||||
$type_class = 'type-' . Html::cleanCssIdentifier(strtolower($label_ascii));
|
$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])) {
|
if (!isset($slides[$type_class])) {
|
||||||
$slides[$type_class] = [
|
$slides[$type_class] = [
|
||||||
'label' => $label,
|
'label' => $label,
|
||||||
|
'tid' => $term->id(),
|
||||||
'rows' => [],
|
'rows' => [],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,11 +22,17 @@
|
|||||||
]
|
]
|
||||||
%}
|
%}
|
||||||
{% if grouped_rows is defined %}
|
{% if grouped_rows is defined %}
|
||||||
|
{% set base_url = path('<front>') ~ 'ressources' %}
|
||||||
{% for type_class, group in grouped_rows %}
|
{% for type_class, group in grouped_rows %}
|
||||||
<div class="view-type-slide {{ type_class }}">
|
<div class="view-type-slide {{ type_class }}">
|
||||||
<h3 class="{{ type_class }}">{{ group.label }}</h3>
|
<h3 class="{{ type_class }}">{{ group.label }}</h3>
|
||||||
<button class="tout-voir" type="button" style="" target="_blank"><a href="https://stage.eql.figli.io/ressources?field_type_de_media_target_id=All&field_type_de_ressource_target_id=595&field_mots_clefs_target_id=All&field_date_de_parution_value=&combine="> Tout voir</a></button>
|
{% if group.tid is defined %}
|
||||||
|
<button class="tout-voir" type="button">
|
||||||
|
<a href="{{ base_url }}?field_type_de_media_target_id=All&field_type_de_ressource_target_id={{ group.tid }}&field_mots_clefs_target_id=All&field_date_de_parution_value=&combine=" target="_blank" rel="noopener noreferrer">
|
||||||
|
Tout voir
|
||||||
|
</a>
|
||||||
|
</button>
|
||||||
|
{% endif %}
|
||||||
<div class="views-row-wrapper">
|
<div class="views-row-wrapper">
|
||||||
{% for row in group.rows %}
|
{% for row in group.rows %}
|
||||||
<div{{ row.attributes.addClass('views-row') }}>
|
<div{{ row.attributes.addClass('views-row') }}>
|
||||||
|
|||||||
Reference in New Issue
Block a user