From 964ef1cf3e649b1ef3a82768a455d727cd9d813a Mon Sep 17 00:00:00 2001 From: Lily Yan <l26yan@uwaterloo.ca> Date: Tue, 29 Aug 2023 14:32:03 -0400 Subject: [PATCH] ISTWCMS-6545 Create an admin-only option to remove the 'on this site' search --- uw_fdsu_theme_resp.theme | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/uw_fdsu_theme_resp.theme b/uw_fdsu_theme_resp.theme index fe09b2ab..dfc9d759 100644 --- a/uw_fdsu_theme_resp.theme +++ b/uw_fdsu_theme_resp.theme @@ -165,7 +165,10 @@ function uw_fdsu_theme_resp_preprocess_region(&$variables) { // Get the region from variables. $region = $variables['elements']['#region']; - + // Set 'search_local' variable if not set. + if (!isset($variables['search_local'])) { + $variables['search_local'] = theme_get_setting('search_show_local', 'uw_fdsu_theme_resp'); + } // Variables that we want to have access to regardless of region. $variables['branding_level'] = theme_get_setting('wcms_branding_level', 'uw_fdsu_theme_resp') ? theme_get_setting('wcms_branding_level', 'uw_fdsu_theme_resp') : 'full'; // The menu style is set based on selection if the level is 'full'. @@ -249,6 +252,20 @@ function uw_fdsu_theme_resp_form_system_theme_settings_alter(&$form, FormStateIn return; } + // Fieldset for search options. + $form['search_options'] = [ + '#type' => 'details', + '#open' => TRUE, + '#title' => t('Search options'), + ]; + + // Search options checkbox field. + $form['search_options']['search_show_local'] = [ + '#type' => 'checkbox', + '#title' => t("Show the 'on this site' search option"), + '#default_value' => theme_get_setting('search_show_local', 'uw_fdsu_theme_resp') ?? TRUE, + ]; + // Fieldset for colour scheme. $form['colour_scheme'] = [ '#type' => 'details', -- GitLab