template suggestions fix
This commit is contained in:
parent
072f7da7de
commit
935fe18134
|
@ -65,17 +65,35 @@ function erabletheme_preprocess_views_view(&$variables) {
|
|||
/* fonctionne mais meilleure méthode avec les suggestions page--xxx */
|
||||
|
||||
function erabletheme_theme_suggestions_views_view_alter(array &$suggestions, array $variables) {
|
||||
if ($variables['title'] !== "") {
|
||||
$view = $variables['title']['#markup'];
|
||||
if (isset($view) && $view === 'Actualités') {
|
||||
// il ne faut pas baser le template sur des contenus !
|
||||
// if ($variables['title'] !== "") {
|
||||
// $view_title = $variables['title']['#markup'];
|
||||
// if (isset($view_title) && $view_title === 'Actualités') {
|
||||
// $suggestions[] = 'views_view__page_actus';
|
||||
// } elseif (isset($view_title) && $view_title === 'Gouvernance') {
|
||||
// $suggestions[] = 'views_view__content_gouvernance';
|
||||
// } elseif (isset($view_title) && $view_title === 'Partenaires') {
|
||||
// $suggestions[] = 'views_view__content_partenaires';
|
||||
// }
|
||||
// elseif (isset($view) && $view === 'Meetup en ligne') {
|
||||
// $suggestions[] = 'views_view__content_meetup';
|
||||
// }
|
||||
// }
|
||||
|
||||
$view = $variables['view'];
|
||||
switch ($view->id()) {
|
||||
case 'actus':
|
||||
$suggestions[] = 'views_view__page_actus';
|
||||
} elseif (isset($view) && $view === 'Gouvernance') {
|
||||
break;
|
||||
case 'gouvernance':
|
||||
$suggestions[] = 'views_view__content_gouvernance';
|
||||
} elseif (isset($view) && $view === 'Partenaires') {
|
||||
break;
|
||||
case 'partenaires':
|
||||
$suggestions[] = 'views_view__content_partenaires';
|
||||
} elseif (isset($view) && $view === 'Meetup en ligne') {
|
||||
break;
|
||||
case 'meetup':
|
||||
$suggestions[] = 'views_view__content_meetup';
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -96,7 +114,10 @@ function erabletheme_theme_suggestions_node_alter(array &$suggestions, array $va
|
|||
}
|
||||
|
||||
function erabletheme_theme_suggestions_region_alter(array &$suggestions, array $variables) {
|
||||
if (isset($variables['elements']['erabletheme_contenudelapageprincipale']) && $variables['elements']['erabletheme_contenudelapageprincipale']['content']['#title'] == "Meet-up en ligne") {
|
||||
// if (isset($variables['elements']['erabletheme_contenudelapageprincipale']) && $variables['elements']['erabletheme_contenudelapageprincipale']['content']['#title'] == "Meet-up en ligne") {
|
||||
// il ne faut pas baser le template sur des contenus !
|
||||
if (isset($variables['elements']['erabletheme_contenudelapageprincipale'])
|
||||
&& $variables['elements']['erabletheme_contenudelapageprincipale']['content']['#view_id'] == "meetup") {
|
||||
$suggestions[] = 'region__offre_meetup';
|
||||
} elseif (isset($variables['elements']['erabletheme_contenudelapageprincipale']) && $variables['elements']['erabletheme_contenudelapageprincipale']['content']['#title'] == "Foire aux Questions") {
|
||||
$suggestions[] = 'region__faq';
|
||||
|
|
Loading…
Reference in New Issue