-
Notifications
You must be signed in to change notification settings - Fork 0
/
bs5.theme
56 lines (52 loc) · 1.41 KB
/
bs5.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
<?php
/**
* Implements hook_preprocess_HOOK() for menu-local-task templates.
*/
function bs5_preprocess_menu_local_task(&$variables) {
// Ensure appropriate classes are set on primary tasks (nav tabs)
if (isset($variables['is_active']) && $variables['is_active'] === TRUE) {
$variables['link']['#options']['attributes']['class'][] = 'active is-active';
}
else {
$variables['link']['#options']['attributes']['class'][] = 'nav-link';
}
// Add the level attribute
if (isset($variables['element']['#level'])) {
$variables['level'] = $variables['element']['#level'];
}
}
/**
* Implements theme_preprocess_textarea().
*/
function bs5_preprocess_textarea(&$variables) {
$variables['attributes']['class'][] = 'form-control';
}
/**
* Implements template_preprocess_HOOK() for input.
*/
function bs5_preprocess_input(&$variables) {
$type_html = $variables['attributes']['type'];
$text_types_html = [
'text',
'email',
'tel',
'number',
'search',
'password',
'url',
'month',
'week',
];
if (in_array($type_html, $text_types_html)) {
$variables['attributes']['class'][] = 'form-control';
}
if (in_array($type_html, ['checkbox'])) {
$variables['attributes']['class'][] = 'form-check-input';
}
}
/**
* Implements theme_preprocess_datetime_form().
*/
function bs5_preprocess_datetime_form(&$variables) {
$variables['attributes']['class'][] = 'form-inline';
}