-
Notifications
You must be signed in to change notification settings - Fork 0
/
idc_ui_theme_boots.theme
86 lines (79 loc) · 3.61 KB
/
idc_ui_theme_boots.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<?php
/**
* @file
* Functions to support theming in the SASS Starterkit subtheme.
*/
use Drupal\Core\Form\FormStateInterface;
/**
* Implements hook_form_system_theme_settings_alter() for settings form.
*
* Replace Barrio setting options with subtheme ones.
*
* Example on how to alter theme settings form
*/
function idc_ui_theme_boots_form_system_theme_settings_alter(&$form, FormStateInterface $form_state) {
$form['components']['navbar']['idc_ui_theme_boots_navbar_top_background']['#options'] = array(
'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']['idc_ui_theme_boots_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']['idc_ui_theme_boots_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']['open_sans'] = 'Open Sans';
$form['fonts']['fonts']['bootstrap_barrio_google_fonts']['#options']['roboto'] = 'Roboto';
$form['fonts']['fonts']['bootstrap_barrio_google_fonts']['#options']['sansita_swashed'] = 'Sansita Swashed';
$form['fonts']['fonts']['bootstrap_barrio_google_fonts']['#options']['Arnhem-Blond'] = 'JHU - Arnhem Blond';
$form['fonts']['fonts']['bootstrap_barrio_google_fonts']['#options']['Arnhem-Bold'] = 'JHU - Arnhem Bold';
$form['fonts']['fonts']['bootstrap_barrio_google_fonts']['#options']['Gentona-BookItalic'] = 'JHU - Gentona BookItalic';
$form['fonts']['fonts']['bootstrap_barrio_google_fonts']['#options']['Gentona-Book'] = 'JHU - Gentona Book';
$form['fonts']['fonts']['bootstrap_barrio_google_fonts']['#options']['Gentona-MediumItalic'] = 'JHU - Gentona MediumItalic';
$form['fonts']['fonts']['bootstrap_barrio_google_fonts']['#options']['Gentona-Medium'] = 'JHU - Gentona Medium';
$form['fonts']['fonts']['bootstrap_barrio_google_fonts']['#options']['Titling-Gothic-Medium'] = 'JHU - Titling Gothic Medium';
$form['fonts']['fonts']['bootstrap_barrio_google_fonts']['#options']['Titling-Gothic-Regular'] = 'JHU - Titling Gothic Regular';
}
/**
* Implements hook_preprocess_HOOK() for html.html.twig.
*/
function idc_ui_theme_boots_preprocess(&$variables, $hook) {
// dvr($variables);
$variables['base_path'] = base_path();
}
function idc_ui_theme_boots_preprocess_page(&$variables)
{
$fonts = theme_get_setting('bootstrap_barrio_google_fonts');
if ($fonts) {
$variables['#attached']['library'][] = (in_array($fonts, ['open_sans', 'roboto', 'sansita_swashed']) ? 'idc_ui_theme_boots' : 'bootstrap_barrio' ) . '/' . $fonts;
}
}
function idc_ui_theme_boots_preprocess_html(&$variables) {
// dvr($variables);
}
/**
* Implements hook_theme_suggestions_HOOK_alter() for form templates.
*/
function idc_ui_theme_boots_theme_suggestions_form_alter(array &$suggestions, array $variables) {
// Check if the form has the specific ID.
if (isset($variables['element']['#id']) && $variables['element']['#id'] == 'search-form') {
$suggestions[] = 'form__search_form';
}
if (isset($variables['element']['#id']) && $variables['element']['#id'] == 'edit-search-textfield') {
$suggestions[] = 'form__search_form__search_textfield';
}
}