From e079bdafb1bc179efa96a139899b70d33469d011 Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Fri, 15 Nov 2024 12:36:14 +1300 Subject: [PATCH] API Ensure themelist returns an array --- src/Extensions/SiteTreeSubsites.php | 3 ++- src/Service/ThemeResolver.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Extensions/SiteTreeSubsites.php b/src/Extensions/SiteTreeSubsites.php index b03f920a..af673df2 100644 --- a/src/Extensions/SiteTreeSubsites.php +++ b/src/Extensions/SiteTreeSubsites.php @@ -402,7 +402,8 @@ public static function contentcontrollerInit($controller) $subsite = Subsite::currentSubsite(); if ($subsite && $subsite->Theme) { - SSViewer::set_themes(ThemeResolver::singleton()->getThemeList($subsite)); + $themeList = ThemeResolver::singleton()->getThemeList($subsite); + SSViewer::set_themes($themeList); } $ignore_subsite_locale = Config::inst()->get(SiteTreeSubsites::class, 'ignore_subsite_locale'); diff --git a/src/Service/ThemeResolver.php b/src/Service/ThemeResolver.php index b91d3bd2..a05d35fd 100644 --- a/src/Service/ThemeResolver.php +++ b/src/Service/ThemeResolver.php @@ -41,7 +41,7 @@ class ThemeResolver * @param Subsite $site * @return array */ - public function getThemeList(Subsite $site) + public function getThemeList(Subsite $site): array { $themes = array_values(SSViewer::get_themes() ?? []); $siteTheme = $site->Theme;