From 7f616347b11b55a94ddf9ceaab8f877ef27e6736 Mon Sep 17 00:00:00 2001 From: joegl <20383-joegl@users.noreply.drupalcode.org> Date: Mon, 16 Oct 2023 12:17:20 -0500 Subject: [PATCH 1/2] Add support for global footer variant. --- .../config/install/stanford_basic.settings.yml | 1 + themes/stanford_basic/stanford_basic.theme | 5 +++++ themes/stanford_basic/templates/page.html.twig | 4 ++-- themes/stanford_basic/theme-settings.php | 16 ++++++++++++++++ 4 files changed, 24 insertions(+), 2 deletions(-) diff --git a/themes/stanford_basic/config/install/stanford_basic.settings.yml b/themes/stanford_basic/config/install/stanford_basic.settings.yml index 5c04ef1b2..0a69457f1 100755 --- a/themes/stanford_basic/config/install/stanford_basic.settings.yml +++ b/themes/stanford_basic/config/install/stanford_basic.settings.yml @@ -10,6 +10,7 @@ favicon: logo: use_default: true brand_bar_variant: default +global_footer_variant: default lockup: option: a line1: Jumpstart diff --git a/themes/stanford_basic/stanford_basic.theme b/themes/stanford_basic/stanford_basic.theme index b8b7f753e..924d21e9f 100755 --- a/themes/stanford_basic/stanford_basic.theme +++ b/themes/stanford_basic/stanford_basic.theme @@ -256,6 +256,11 @@ function stanford_basic_preprocess_page(&$vars) { if ($bbv !== "none") { $vars['brand_bar_variant'] = 'su-brand-bar--' . $bbv; } + // Variant setting for the global footer. + $global_footer_variant = theme_get_setting('global_footer_variant'); + if ($global_footer_variant !== "none") { + $vars['global_footer_variant'] = 'su-global-footer--' . $global_footer_variant; + } // Prepares non node/panel pages to be in a single column. _stanford_basic_preprocess_not_nodes($vars); diff --git a/themes/stanford_basic/templates/page.html.twig b/themes/stanford_basic/templates/page.html.twig index 0d0cc83be..443c01467 100755 --- a/themes/stanford_basic/templates/page.html.twig +++ b/themes/stanford_basic/templates/page.html.twig @@ -44,7 +44,7 @@ {%- block block_help -%} {{ page.help }} {%- endblock -%} - +
{{ page.header }} {{ page.search }} @@ -65,7 +65,7 @@ {%- block block_footer -%} {%- endblock -%} diff --git a/themes/stanford_basic/theme-settings.php b/themes/stanford_basic/theme-settings.php index 960879de4..e9d81873e 100755 --- a/themes/stanford_basic/theme-settings.php +++ b/themes/stanford_basic/theme-settings.php @@ -37,6 +37,22 @@ function stanford_basic_form_system_theme_settings_alter(array &$form, FormState '#default_value' => theme_get_setting('brand_bar_variant'), ]; + // Global footer support. + $form['options_settings']['stanford_basic_global_footer'] = [ + '#type' => 'fieldset', + '#title' => t('Global Footer Settings'), + ]; + + $form['options_settings']['stanford_basic_global_footer']['global_footer_variant'] = [ + '#type' => 'select', + '#title' => t('Global Footer Variant'), + '#options' => [ + 'default' => '- Default -', + 'dark' => t('Dark'), + ], + '#default_value' => theme_get_setting('global_footer_variant'), + ]; + $img = ''; $decanter = Link::fromTextAndUrl('Decanter Lockup Component', Url::fromUri('https://decanter.stanford.edu/component/identity-lockup/')) From 587bd04aaaf27a6b409b6d7b139d7bec957591b2 Mon Sep 17 00:00:00 2001 From: joegl <20383-joegl@users.noreply.drupalcode.org> Date: Wed, 18 Oct 2023 10:23:56 -0500 Subject: [PATCH 2/2] Changed default to empty option. --- themes/stanford_basic/stanford_basic.theme | 3 +-- themes/stanford_basic/theme-settings.php | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/themes/stanford_basic/stanford_basic.theme b/themes/stanford_basic/stanford_basic.theme index 924d21e9f..8da07169d 100755 --- a/themes/stanford_basic/stanford_basic.theme +++ b/themes/stanford_basic/stanford_basic.theme @@ -257,8 +257,7 @@ function stanford_basic_preprocess_page(&$vars) { $vars['brand_bar_variant'] = 'su-brand-bar--' . $bbv; } // Variant setting for the global footer. - $global_footer_variant = theme_get_setting('global_footer_variant'); - if ($global_footer_variant !== "none") { + if ($global_footer_variant = theme_get_setting('global_footer_variant')) { $vars['global_footer_variant'] = 'su-global-footer--' . $global_footer_variant; } diff --git a/themes/stanford_basic/theme-settings.php b/themes/stanford_basic/theme-settings.php index e9d81873e..67b20bb43 100755 --- a/themes/stanford_basic/theme-settings.php +++ b/themes/stanford_basic/theme-settings.php @@ -47,9 +47,9 @@ function stanford_basic_form_system_theme_settings_alter(array &$form, FormState '#type' => 'select', '#title' => t('Global Footer Variant'), '#options' => [ - 'default' => '- Default -', 'dark' => t('Dark'), ], + '#empty_option' => t('- Default -'), '#default_value' => theme_get_setting('global_footer_variant'), ];