D10 theme for Island Scholar v2 Clone of "vre2024"
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
998 B

4 weeks ago
<?php
/**
* @file
* Extra Functions for vre2024
*/
function vre2024_preprocess_page(array &$variables) {
$config = \Drupal::config('system.site');
$variables['site_name'] = $config->get('name');
$variables['site_slogan'] = $config->get('slogan');
$variables['base_path'] = base_path();
$variables['scrolltotop_on'] = 1;
}
/**
* Add current page to breadcrumb.
*/
function vre2024_preprocess_breadcrumb(&$variables) {
$request = \Drupal::request();
$route_match = \Drupal::routeMatch();
$page_title = \Drupal::service('title_resolver')->getTitle($request, $route_match->getRouteObject());
if (!empty($page_title)) {
$variables['breadcrumb'][] = [
'text' => $page_title,
];
// Add cache context based on url.
$variables['#cache']['contexts'][] = 'url';
}
$variables['breadcrumb_icon_style'] = '/';
}
/**
* Html preprocess for the theme.
*/
function vre2024_preprocess_html(&$variables) {
$variables['is_front'] = \Drupal::service('path.matcher')->isFrontPage();
}