diff --git a/module/VuFindTheme/src/VuFindTheme/Initializer.php b/module/VuFindTheme/src/VuFindTheme/Initializer.php index bef5f0852f96dc817b40d54b8f6be5a8c0b4adff..bbfba623472055f27fc66730c9174604001855e1 100644 --- a/module/VuFindTheme/src/VuFindTheme/Initializer.php +++ b/module/VuFindTheme/src/VuFindTheme/Initializer.php @@ -86,6 +86,13 @@ class Initializer */ protected $cookieManager; + /** + * A static flag used to determine if the theme has been initialized + * + * @var bool + */ + protected static $themeInitialized = false; + /** * Constructor * @@ -180,6 +187,12 @@ class Initializer */ public function init() { + // Make sure to initialize the theme just once + if (self::$themeInitialized) { + return; + } + self::$themeInitialized = true; + // Determine the current theme: $currentTheme = $this->pickTheme($this->event->getRequest());