drupal-caravane/web/themes/custom/caravane/caravane.theme

61 lines
1.9 KiB
PHP

<?php
use GuzzleHttp\Psr7\Uri;
/**
* @file
* Functions to support theming in the caravane theme.
*/
function caravane_page_attachments_alter(&$page) {
if (getenv('APP_ENV') === 'development') {
// $attachments['#attached']['html_head'][] = [['src' => 'http://localhost:5173/@vite/client', 'type' => 'module'],'vite-client'];
// $page['#attached']['library'][] = 'http://localhost:5173/@vite/client';
// $attachments['#attached']['html_head'][] = [['src' => 'http://localhost:5173/assets/js/main.js', 'type' => 'module'],'vite-main'];
// $page['#attached']['library'][] = 'http://localhost:5173/assets/js/main.js';
$page['#attached']['library'][] = 'caravane/vitehmr';
}else{
$page['#attached']['library'][] = 'caravane/global';
}
}
/**
* Implements hook_preprocess_HOOK() for html.html.twig.
*/
function caravane_preprocess_html(&$variables) {
}
/**
* Implements hook_preprocess_HOOK() for page.html.twig.
*/
function caravane_preprocess_page(&$variables) {
}
/**
* Implements hook_preprocess_HOOK() for node.html.twig.
*/
function caravane_preprocess_node(&$variables) {
}
function cavarane_preprocess_block(&$variables) {
}
function caravane_theme_suggestions_views_view_field_alter(array &$suggestions, array $variables) {
$view = $variables['view'];
$display_id = $variables['view']->current_display;
if ($display_id == 'block_1' && $view->id() == 'etapes') {
$suggestions[] = 'views_view_field__block_1__etape_list';
}
if ($display_id == 'block_2') {
$suggestions[] = 'views_view_field__block_2__popup_map';
}
}
function caravane_theme_suggestions_views_view_fields_alter(array &$suggestions, array $variables) {
$view = $variables['view'];
$display_id = $variables['view']->current_display;
$view_id = $view->id();
if ($display_id == 'block_1' && $view_id == 'etapes') {
$suggestions[] = 'views_view_fields__block_2__liste_etapes';
}
}