diaporama layout

This commit is contained in:
2024-04-29 11:02:04 +02:00
parent 482478f2ea
commit 03412b3ac1
7 changed files with 96 additions and 20 deletions

View File

@@ -40,13 +40,29 @@ function popsu_preprocess_html(&$variables) {
}
}
function popsu_preprocess_page(&$variables) {
if(isset($variables['node'])){
// function popsu_preprocess_page(&$variables) {
// if(isset($variables['node'])){
// $node = $variables['node'];
// if(isset($node) && $node->hasField('field_videos') && $node->get('field_videos')->getString() != ""){
// $variables['attributes']['class'][] = 'ressources-video';
// }
// }
// }
function popsu_preprocess_page__node(&$variables) {
$node = $variables['node'];
if(isset($node) && $node->hasField('field_videos') && $node->get('field_videos')->getString() != ""){
$variables['attributes']['class'][] = 'ressources-video';
}
if($node->getType() === "ressource"){
$type_ref_entity = $node->get('field_type_de_ressource')->referencedEntities();
if(count($type_ref_entity)){
// $type = filter_var(strtolower(str_replace(" ", "-", $type_ref_entity[0]->getName())), FILTER_SANITIZE_URL);
// setlocale(LC_ALL, "en_US.utf8");
// $type = iconv('UTF-8','ASCII//TRANSLIT//IGNORE',strtolower(str_replace(" ", "-", $type_ref_entity[0]->getName())));
$trans = \Drupal::transliteration();
$type = $trans->transliterate(strtolower(str_replace(" ", "-", $type_ref_entity[0]->getName())), 'en');
$variables['attributes']['class'][] = 'ressources-' . $type;
}
}
}
function popsu_preprocess_node(&$variables){