diaporama layout
This commit is contained in:
@@ -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){
|
||||
|
Reference in New Issue
Block a user