forked from Islandora-Devops/islandora_starter_theme
-
Notifications
You must be signed in to change notification settings - Fork 2
/
dpl_theme.theme
59 lines (52 loc) · 1.85 KB
/
dpl_theme.theme
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
/**
* @file
* Functions to support theming in the BD Client SASS Starterkit subtheme.
*/
use Drupal\Core\Form\FormStateInterface;
/**
* Implements hook_theme_suggestions_HOOK_alter for blocks.
*/
function dpl_theme_theme_suggestions_block_alter(&$suggestions, $variables) {
// Load theme suggestions for blocks from parent theme.
foreach ($suggestions as &$suggestion) {
$suggestion = str_replace('dpl_theme_', 'islandora_base_theme_', $suggestion);
}
}
function dpl_theme_form_system_theme_settings_alter(&$form, FormStateInterface $form_state) {
$form['components']['navbar']['bootstrap_barrio_navbar_top_background']['#options'] = [
'bg-primary' => t('Primary'),
'bg-secondary' => t('Secondary'),
'bg-light' => t('Light'),
'bg-dark' => t('Dark'),
'bg-white' => t('White'),
'bg-transparent' => t('Transparent'),
];
$form['components']['navbar']['bootstrap_barrio_navbar_background']['#options'] = [
'bg-primary' => t('Primary'),
'bg-secondary' => t('Secondary'),
'bg-light' => t('Light'),
'bg-dark' => t('Dark'),
'bg-white' => t('White'),
'bg-transparent' => t('Transparent'),
];
$form['fonts']['fonts']['bootstrap_barrio_google_fonts']['#options']['opensans'] = 'Open Sans';
}
function dpl_theme_preprocess_page(&$variables) {
$fonts = theme_get_setting('bootstrap_barrio_google_fonts');
if ($fonts)
$variables['#attached']['library'][] = (in_array($fonts, ['opensans']) ? 'dpl_theme' : 'bootstrap_barrio' ) . '/' . $fonts;
}
/**
* Implements hook_preprocess_block().
*/
function dpl_theme_preprocess_block(&$variables) {
// set is front page variable
$variables['is_front'] = \Drupal::service('path.matcher')->isFrontPage();
}
/**
* Implements hook_preprocess_view_view().
*/
function dpl_theme_preprocess_views_view(&$variables) {
$variable['additional_classes'] = ['view-grid'];
}