avancées intégration mobile

This commit is contained in:
Valentin
2023-12-13 15:08:55 +01:00
parent a08922d8be
commit 1bf7b2b251
22 changed files with 932 additions and 75 deletions

View File

@@ -23,7 +23,7 @@ function erabletheme_preprocess_page(&$variables) {
* Implements hook_preprocess_HOOK() for node.html.twig.
*/
function erabletheme_preprocess_node(&$variables) {
$t = "t";
}
/**
@@ -35,4 +35,41 @@ function erabletheme_preprocess_form(&$variables) {
function erabletheme_preprocess_region(&$variables) {
$t="t";
}
function erabletheme_preprocess_views_view(&$variables) {
$t="t";
}
/* 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') {
$suggestions[] = 'views_view__page_actus';
} elseif (isset($view) && $view === 'Gouvernance') {
$suggestions[] = 'views_view__content_gouvernance';
} elseif (isset($view) && $view === 'Partenaires') {
$suggestions[] = 'views_view__content_partenaires';
}
}
}
function erabletheme_theme_suggestions_node_alter(array &$suggestions, array $variables) {
$is_actu = isset($variables['elements']['field_type_d_actualite']);
if (!$is_actu && isset($variables['elements']['#title'])) {
$total_title = $variables['elements']['#title'];
$start_pos = strpos($total_title, '<span>') + strlen('<span>');
$end_pos = strpos($total_title, '</span>');
$processed_title = substr($total_title, $start_pos, $end_pos - $start_pos);
if ($processed_title !== 'Partenaires' || $processed_title !== 'Gouvernance') {
$suggestions[] = 'node__content_global';
}
}
}