-
Notifications
You must be signed in to change notification settings - Fork 0
/
ucb_campus_map.module
43 lines (39 loc) · 1.06 KB
/
ucb_campus_map.module
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
/**
* @file
* Contains functional hooks used by the CU Boulder Campus Map module.
*/
/**
* Implements hook_theme_suggestions_HOOK_alter().
*
* Allows the campus map template in this module to override the site homepage.
*/
function ucb_campus_map_theme_suggestions_page_alter(array &$suggestions, array $variables) {
if (\Drupal::service('path.matcher')->isFrontPage()) {
$suggestions[] = 'page__campus_map';
}
}
/**
* Implements hook_preprocess_HOOK().
*
* Modfiies the homepage title to avoid duplication, e.g. “Campus Map | Campus
* Map | University of Colorado Boulder”. The title is set to the site name.
*/
function ucb_campus_map_preprocess_html(array &$variables) {
if (\Drupal::service('path.matcher')->isFrontPage()) {
$variables['head_title'] = [\Drupal::config('system.site')->get('name')];
}
}
/**
* Implements hook_theme().
*
* Exposes the `page--campus-map.html.twig` template to Drupal's theming
* engine.
*/
function ucb_campus_map_theme() {
return [
'page__campus_map' => [
'variables' => [],
],
];
}