drupal-erable/web/themes/erabletheme/erabletheme.theme

83 lines
2.6 KiB
PHP
Raw Normal View History

2023-11-30 17:33:32 +01:00
<?php
/**
* @file
* Functions to support theming in the erabletheme theme.
*/
/**
* Implements hook_preprocess_HOOK() for html.html.twig.
*/
function erabletheme_preprocess_html(&$variables) {
}
/**
* Implements hook_preprocess_HOOK() for page.html.twig.
*/
function erabletheme_preprocess_page(&$variables) {
}
/**
* Implements hook_preprocess_HOOK() for node.html.twig.
*/
function erabletheme_preprocess_node(&$variables) {
2023-12-13 15:08:55 +01:00
$t = "t";
2023-11-30 17:33:32 +01:00
}
2023-12-04 13:56:23 +01:00
/**
* Implements hook_preprocess_HOOK() for node.html.twig.
*/
function erabletheme_preprocess_form(&$variables) {
$t="t";
}
function erabletheme_preprocess_region(&$variables) {
$t="t";
2023-12-13 15:08:55 +01:00
}
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';
2024-03-29 21:29:59 +01:00
} elseif (isset($view) && $view === 'Meetup en ligne') {
$suggestions[] = 'views_view__content_meetup';
2023-12-13 15:08:55 +01:00
}
}
}
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';
}
}
2024-03-29 21:29:59 +01:00
}
2023-12-13 15:08:55 +01:00
2024-03-29 21:29:59 +01:00
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") {
$suggestions[] = 'region__offre_meetup';
} elseif (isset($variables['elements']['erabletheme_contenudelapageprincipale']) && $variables['elements']['erabletheme_contenudelapageprincipale']['content']['#title'] == "Foire aux Questions") {
$suggestions[] = 'region__faq';
}
}