forked from esmero/archipelago_subtheme
-
Notifications
You must be signed in to change notification settings - Fork 0
/
archipelago_subtheme.theme
76 lines (68 loc) · 2.43 KB
/
archipelago_subtheme.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
<?php
/**
* @file
* Functions to support theming in the SASS Starterkit subtheme.
*/
use Drupal\Core\Template\Attribute;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Component\Utility\Html;
/**
* Implements hook_form_system_theme_settings_alter() for settings form.
*
*/
function archipelago_subtheme_form_system_theme_settings_alter(&$form, FormStateInterface $form_state) {
$form['components']['navbar']['bootstrap_barrio_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']['bootstrap_barrio_navbar_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'),
);
}
function archipelago_subtheme_form_views_exposed_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
if (isset($form['search_api_fulltext'])) {
$form['search_api_fulltext']['#attributes']['placeholder'] = t('Search');
}
if (isset($form['sort_by'])) {
$form['sort_by']['#attributes']['class'][] = Html::cleanCssIdentifier('d-none');
$form['sort_by']['#attributes']['class'][] = Html::cleanCssIdentifier('d-lg-block');
}
if (isset($form['sort_order'])) {
$form['sort_order']['#attributes']['class'][] = Html::cleanCssIdentifier('d-none');
$form['sort_order']['#attributes']['class'][] = Html::cleanCssIdentifier('d-lg-block');
}
}
/**
* Implements hook_preprocess_HOOK() for menu.html.twig.
*/
function archipelago_subtheme_preprocess_page(&$variables) {
// Define navigation toggle size
switch (theme_get_setting('bootstrap_barrio_navbar_toggle')) {
case 'navbar-toggleable-lg':
$expand_class = 'navbar-expand-lg';
break;
case 'navbar-toggleable-md':
$expand_class = 'navbar-expand-md';
break;
case 'navbar-toggleable-sm':
$expand_class = 'navbar-expand-sm';
break;
case 'navbar-toggleable-xs':
$expand_class = 'navbar-expand-xs';
break;
default:
$expand_class = 'navbar-expand-md';
break;
}
/* @var Attribute $variables['navbar_top_attributes'] */
$variables['navbar_top_attributes']->addClass($expand_class);
}