diff --git a/config/schema/localgov_base.schema.yml b/config/schema/localgov_base.schema.yml index 530c92bc..b8234368 100644 --- a/config/schema/localgov_base.schema.yml +++ b/config/schema/localgov_base.schema.yml @@ -41,3 +41,8 @@ localgov_base.settings: label: 'Responsive WYSIWYG tables' description: 'Choose whether to make WYSIWYG tables responsive or not.' default_value: TRUE + localgov_base_extra_css: + type: string + label: 'Extra CSS' + description: 'Add any additional CSS styles you want to include.' + default_value: '' diff --git a/localgov_base.theme b/localgov_base.theme index 35f4e27e..ff99de8b 100644 --- a/localgov_base.theme +++ b/localgov_base.theme @@ -145,6 +145,19 @@ function localgov_base_form_system_theme_settings_alter(&$form, FormStateInterfa '#description' => t('This will display the guide navigation vertically above the guide.'), ]; + $form['localgov_base_settings']['theme_styles_fieldset'] = [ + '#type' => 'fieldset', + '#title' => t('Theme Styles'), + '#description' => t('Control various theme styles.'), + ]; + + $form['localgov_base_settings']['theme_styles_fieldset']['localgov_base_extra_css'] = [ + '#type' => 'textarea', + '#title' => t('Extra CSS'), + '#default_value' => theme_get_setting('localgov_base_extra_css') ?: '', + '#description' => t('Add any additional CSS styles you want to include. We suggest this box should only be used for small amounts of CSS during development. CSS should ideally be added in your sub-theme and tracked in version control.'), + ]; + $form['#validate'][] = 'localgov_base_theme_settings_validate'; } @@ -200,6 +213,12 @@ function localgov_base_preprocess_html(&$variables): void { $variables['#attached']['library'][] = 'localgov_base/responsive-tables'; } } + + // Add CSS variables for accent colour, line height, and default spacing. + if (!empty(theme_get_setting('localgov_base_extra_css'))) { + // Add a style tag with the custom CSS to the head. + $variables['localgov_base_extra_css'] = theme_get_setting('localgov_base_extra_css'); + } } /** diff --git a/templates/layout/html.html.twig b/templates/layout/html.html.twig index 29827fb8..89483211 100644 --- a/templates/layout/html.html.twig +++ b/templates/layout/html.html.twig @@ -39,9 +39,9 @@