diff --git a/module/VuFindTheme/src/VuFindTheme/Initializer.php b/module/VuFindTheme/src/VuFindTheme/Initializer.php index 33762b4a663..4409e4566f6 100644 --- a/module/VuFindTheme/src/VuFindTheme/Initializer.php +++ b/module/VuFindTheme/src/VuFindTheme/Initializer.php @@ -162,7 +162,8 @@ public function init() } self::$themeInitialized = true; - // Determine the current theme: + // Determine the current theme (this sets the ui cookie as a side effect, + // which we will need to use in the line below): $currentTheme = $this->pickTheme( isset($this->event) ? $this->event->getRequest() : null ); @@ -277,18 +278,18 @@ protected function pickTheme(?Request $request) /** * Make the theme options available to the view. * - * @param string $currentTheme Active theme + * @param string $activeThemeOption Active theme option (ui cookie, not actual theme name) * * @return void */ - protected function sendThemeOptionsToView($currentTheme) + protected function sendThemeOptionsToView($activeThemeOption) { // Get access to the view model: if (PHP_SAPI !== 'cli') { $viewModel = $this->serviceManager->get('ViewManager')->getViewModel(); // Send down the view options: - $viewModel->setVariable('themeOptions', $this->getThemeOptions($currentTheme)); + $viewModel->setVariable('themeOptions', $this->getThemeOptions($activeThemeOption)); } } @@ -296,11 +297,11 @@ protected function sendThemeOptionsToView($currentTheme) * Return an array of information about user-selectable themes. Each entry in * the array is an associative array with 'name', 'desc' and 'selected' keys. * - * @param string $currentTheme Active theme + * @param string $activeThemeOption Active theme (ui cookie, not actual theme name) * * @return array */ - protected function getThemeOptions($currentTheme) + protected function getThemeOptions($activeThemeOption) { $options = []; if (isset($this->config->selectable_themes)) { @@ -313,7 +314,7 @@ protected function getThemeOptions($currentTheme) if (!empty($name)) { $options[] = [ 'name' => $name, 'desc' => $desc, - 'selected' => ($currentTheme == $name), + 'selected' => ($activeThemeOption == $name), ]; } }