diff --git a/src/Hook/Header.php b/src/Hook/Header.php index 3f08703..1e66050 100644 --- a/src/Hook/Header.php +++ b/src/Hook/Header.php @@ -17,9 +17,22 @@ class Header extends AbstractHook { public const HOOK_LIST = [ + 'actionFrontControllerInitBefore', 'displayHeader', ]; + public function hookActionFrontControllerInitBefore(): void + { + $themeListDisplay = new ThemeListDisplay(); + $this->context->smarty->assign([ + 'listingDisplayType' => $themeListDisplay->getDisplay(), + 'preloadCss' => \Configuration::get(GeneralConfiguration::THEMECORE_PRELOAD_CSS), + 'webpEnabled' => \Configuration::get(WebpConfiguration::THEMECORE_WEBP_ENABLED), + 'loadPartytown' => (bool) \Configuration::get(GeneralConfiguration::THEMECORE_LOAD_PARTY_TOWN), + 'debugPartytown' => (bool) \Configuration::get(GeneralConfiguration::THEMECORE_DEBUG_PARTY_TOWN), + ]); + } + public function hookDisplayHeader(): string { $themeListDisplay = new ThemeListDisplay(); @@ -32,12 +45,7 @@ public function hookDisplayHeader(): string } $this->context->smarty->assign([ - 'listingDisplayType' => $themeListDisplay->getDisplay(), - 'preloadCss' => \Configuration::get(GeneralConfiguration::THEMECORE_PRELOAD_CSS), - 'webpEnabled' => \Configuration::get(WebpConfiguration::THEMECORE_WEBP_ENABLED), 'jsonData' => $this->getStructuredData(), - 'loadPartytown' => (bool) \Configuration::get(GeneralConfiguration::THEMECORE_LOAD_PARTY_TOWN), - 'debugPartytown' => (bool) \Configuration::get(GeneralConfiguration::THEMECORE_DEBUG_PARTY_TOWN), 'partytownScript' => $this->getPartytownScript(), 'partytownScriptUri' => $this->getPartytownScriptUri(), ]);