|
@@ -277,6 +277,7 @@ function eql_preprocess_views_view_unformatted(array &$variables) {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
function eql_preprocess_form(&$variables) {
|
|
function eql_preprocess_form(&$variables) {
|
|
$terms = \Drupal::entityTypeManager()
|
|
$terms = \Drupal::entityTypeManager()
|
|
->getStorage('taxonomy_term')
|
|
->getStorage('taxonomy_term')
|
|
@@ -285,14 +286,19 @@ function eql_preprocess_form(&$variables) {
|
|
$transliterator = \Drupal::service('transliteration');
|
|
$transliterator = \Drupal::service('transliteration');
|
|
$media_links = [];
|
|
$media_links = [];
|
|
|
|
|
|
|
|
+ // Récupère la valeur actuelle du filtre dans l’URL
|
|
|
|
+ $request = \Drupal::request();
|
|
|
|
+ $active_tid = $request->query->get('field_type_de_media_target_id');
|
|
|
|
+
|
|
foreach ($terms as $term) {
|
|
foreach ($terms as $term) {
|
|
- $slug = strtolower($transliterator->transliterate($term->name));
|
|
|
|
|
|
+ $slug = Html::cleanCssIdentifier(strtolower($transliterator->transliterate($term->name)));
|
|
$slug = Html::cleanCssIdentifier($slug); // Nettoie pour CSS
|
|
$slug = Html::cleanCssIdentifier($slug); // Nettoie pour CSS
|
|
|
|
|
|
$media_links[] = [
|
|
$media_links[] = [
|
|
'tid' => $term->tid,
|
|
'tid' => $term->tid,
|
|
'label' => $term->name,
|
|
'label' => $term->name,
|
|
'slug' => $slug,
|
|
'slug' => $slug,
|
|
|
|
+ 'active' => (string)$term->tid === $active_tid, // <-- True si c'est celui sélectionné
|
|
];
|
|
];
|
|
}
|
|
}
|
|
|
|
|
|
@@ -305,6 +311,3 @@ function eql_preprocess_form(&$variables) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|