bouton media dynamiques
This commit is contained in:
@@ -76,6 +76,9 @@ function eql_preprocess_page(array &$variables) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function eql_preprocess_block(array &$variables) {
|
||||
// Vérifie si on est sur une page node de type 'ressource'
|
||||
$route_match = \Drupal::routeMatch();
|
||||
@@ -268,6 +271,28 @@ function eql_preprocess_views_view_unformatted(array &$variables) {
|
||||
}
|
||||
|
||||
|
||||
function eql_preprocess_form(&$variables) {
|
||||
$terms = \Drupal::entityTypeManager()
|
||||
->getStorage('taxonomy_term')
|
||||
->loadTree('type_de_media');
|
||||
|
||||
$transliterator = \Drupal::service('transliteration');
|
||||
$media_links = [];
|
||||
|
||||
foreach ($terms as $term) {
|
||||
$slug = strtolower($transliterator->transliterate($term->name));
|
||||
$slug = Html::cleanCssIdentifier($slug); // Nettoie pour CSS
|
||||
|
||||
$media_links[] = [
|
||||
'tid' => $term->tid,
|
||||
'label' => $term->name,
|
||||
'slug' => $slug,
|
||||
];
|
||||
}
|
||||
|
||||
$variables['media_links'] = $media_links;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user