forked from SU-SWS/saa_victoria_subtheme
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy paththeme-settings.php
55 lines (48 loc) · 2.05 KB
/
theme-settings.php
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
<?php
/**
* @file
* SAA Theme Settings.
* Note: Theme settings are close to Stanford Basic but hide brandbar and masthead style options, since those are enforced with custom styles in this theme.
*/
use Drupal\Core\Form\FormStateInterface;
// Set theme name to use in the key values.
$theme_name = \Drupal::theme()->getActiveTheme()->getName();
/**
* Implements hook_form_system_theme_settings_alter().
*/
function saa_victoria_subtheme_form_system_theme_settings_alter(array &$form, FormStateInterface $form_state) {
$form['options_settings'] = [
'#type' => 'fieldset',
'#title' => t('Theme Specific Settings'),
];
// BrowserSync support.
$form['options_settings']['stanford_basic_browser_sync'] = [
'#type' => 'fieldset',
'#title' => t('BrowserSync Settings'),
];
$form['options_settings']['stanford_basic_browser_sync']['browser_sync']['#tree'] = TRUE;
$form['options_settings']['stanford_basic_browser_sync']['browser_sync']['enabled'] = [
'#type' => 'checkbox',
'#title' => t('Enable BrowserSync support for theme'),
'#default_value' => theme_get_setting('browser_sync.enabled'),
'#description' => t("Checking this box will automatically add the BrowserSync JS to your theme for development."),
];
$form['options_settings']['stanford_basic_browser_sync']['browser_sync']['host'] = [
'#type' => 'textfield',
'#title' => t('BrowserSync host'),
'#default_value' => theme_get_setting('browser_sync.host'),
'#description' => t("Default: localhost. Enter 'HOST' which will be replaced by your site's hostname."),
'#states' => [
'visible' => [':input[name="browser_sync[enabled]"]' => ['checked' => TRUE]],
],
];
$form['options_settings']['stanford_basic_browser_sync']['browser_sync']['port'] = [
'#type' => 'number',
'#title' => t('Enable BrowserSync support for theme'),
'#default_value' => theme_get_setting('browser_sync.port'),
'#description' => t("Default: '3000'."),
'#states' => [
'visible' => [':input[name="browser_sync[enabled]"]' => ['checked' => TRUE]],
],
];
}