Skip to content

Commit

Permalink
Merge pull request #49 from WEBP-Antonin/patch-2
Browse files Browse the repository at this point in the history
Update Header.php
  • Loading branch information
Oksydan authored Mar 19, 2024
2 parents 484628f + ffc8dd3 commit a8790c4
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/Hook/Header.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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(),
]);
Expand Down

0 comments on commit a8790c4

Please sign in to comment.