Skip to content

Commit

Permalink
swaps bg colour setting from 'remove' to 'add'
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Conroy committed Nov 9, 2023
1 parent f527c95 commit 089e519
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 14 deletions.
8 changes: 4 additions & 4 deletions config/install/localgov_base.settings.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
localgov_base_remove_css: false
localgov_base_remove_js: false
localgov_base_remove_unpublished_background_colour: false
localgov_base_add_draft_note_to_unpublished_content: false
localgov_base_remove_css: FALSE
localgov_base_remove_js: FALSE
localgov_base_add_unpublished_background_colour: TRUE
localgov_base_add_draft_note_to_unpublished_content: FALSE
4 changes: 2 additions & 2 deletions config/schema/localgov_base.schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ localgov_base.settings:
localgov_base_remove_js:
type: boolean
label: 'Remove JS libraries from base theme.'
localgov_base_remove_unpublished_background_colour:
localgov_base_add_unpublished_background_colour:
type: boolean
label: 'Remove pink background from unpublished content.'
label: 'Add background colour to unpublished content.'
localgov_base_add_draft_note_to_unpublished_content:
type: boolean
label: 'Add "[Draft]" to title of unpublished content.'
File renamed without changes.
4 changes: 2 additions & 2 deletions localgov_base.libraries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ region-tabs:
theme:
css/components/region-tabs.css: {}

unpublished:
unpublished-bg:
css:
theme:
css/components/unpublished.css: {}
css/components/unpublished-bg.css: {}

callout:
css:
Expand Down
13 changes: 7 additions & 6 deletions localgov_base.theme
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ function localgov_base_form_system_theme_settings_alter(&$form, FormStateInterfa
'#description' => t("Check this box to disable the base theme's JavaScript"),
];

$form['localgov_base_remove_unpublished_background_colour'] = [
$form['localgov_base_add_unpublished_background_colour'] = [
'#type' => 'checkbox',
'#title' => t('Remove pink background from unpublished content.'),
'#default_value' => theme_get_setting('localgov_base_remove_unpublished_background_colour'),
'#description' => t("If you remove the pink background, you should probably also check the box below to add '[Draft]' to the title of unpublished content."),
'#title' => t('Add background colour to unpublished content.'),
'#default_value' => theme_get_setting('localgov_base_add_unpublished_background_colour'),
'#description' => t("If you remove the background colour, you should probably also check the box below to add '[Draft]' to the title of unpublished content."),
];

$form['localgov_base_add_draft_note_to_unpublished_content'] = [
Expand Down Expand Up @@ -83,8 +83,9 @@ function localgov_base_preprocess_page(&$variables) {
// We have a theme setting boolean for removing the pink background from
// unpublished content. If that setting is false,
// we will add the 'unpublished' library to our page.
if (theme_get_setting('localgov_base_remove_unpublished_background_colour') == FALSE) {
$variables['#attached']['library'][] = 'localgov_base/unpublished';
dpm(theme_get_setting('localgov_base_add_unpublished_background_colour'));
if (theme_get_setting('localgov_base_add_unpublished_background_colour') == TRUE) {
$variables['#attached']['library'][] = 'localgov_base/unpublished-bg';
}
}

Expand Down

0 comments on commit 089e519

Please sign in to comment.