diff --git a/uw_fdsu_theme_resp.theme b/uw_fdsu_theme_resp.theme index 59d5bed1fafa525a49cf02ff861415800246e644..9d4940ad6a425ae3e915cd51c398f59d7c08952a 100644 --- a/uw_fdsu_theme_resp.theme +++ b/uw_fdsu_theme_resp.theme @@ -11,6 +11,17 @@ use Drupal\Core\DateTimeZone; require_once dirname(__FILE__) . '/uw_wcms_gesso/gesso/gesso.theme'; +/** + * Implements hook_preprocess_HOOK(). + * + * Setting the faculty class colour. + */ +function uw_fdsu_theme_resp_preprocess_html(&$variables) { + + // Adding the faculty colour class to the body. + $variables['attributes']['class'][] = theme_get_setting('wcms_colour_scheme', 'uw_fdsu_theme_resp') ? theme_get_setting('wcms_colour_scheme', 'uw_fdsu_theme_resp') : 'default'; +} + /** * Implements hook_preprocess_region(). */ @@ -57,6 +68,47 @@ function uw_fdsu_theme_resp_preprocess_node(&$variables) { } } +/** + * Implements hook_FORM_ID_alter. + * + * Add settings for colour scheme. + */ +function uw_fdsu_theme_resp_form_system_theme_settings_alter(&$form, \Drupal\Core\Form\FormStateInterface &$form_state, $form_id = NULL) { + + // Work-around for a core bug affecting admin themes. See issue #943212. + if (isset($form_id)) { + return; + } + + // Fieldset for colour scheme. + $form['colour_scheme'] = array( + '#type' => 'details', + '#open' => TRUE, + '#title' => t('Colour scheme'), + ); + + // Colour scheme select list. + $form['colour_scheme']['wcms_colour_scheme'] = array( + '#type' => 'select', + '#default_value' => theme_get_setting('wcms_colour_scheme', 'uw_fdsu_theme_resp') ? theme_get_setting('wcms_colour_scheme', 'uw_fdsu_theme_resp') : 'default', + '#description' => t("Select a color scheme to use"), + '#options' => [ + 'default' => 'Default (yellow/red)', + 'ahs' => 'Applied Health Sciences (teal)', + 'art' => 'Arts (orange)', + 'eng' => 'Engineering (purple)', + 'env' => 'Environment (green)', + 'mat' => 'Mathematics (pink)', + 'sci' => 'Science (blue)', + 'cgc' => 'Conrad Grebel University College', + 'ren' => 'Renison University College', + 'stj' => 'St. Jerome\'s University', + 'stp' => 'St. Paul\'s University College', + 'school' => 'School (red)', + ], + ); +} + /** * Implements hook_preprocess_paragraph(). *