From a3c4e19f9547397e153fcb7efd57dc56e0c00456 Mon Sep 17 00:00:00 2001 From: Tony Air Date: Tue, 30 Apr 2024 14:23:25 +0200 Subject: [PATCH] FIX: Theme detection --- src/Templates/WebpackTemplateProvider.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/Templates/WebpackTemplateProvider.php b/src/Templates/WebpackTemplateProvider.php index d563537..9bff3c3 100755 --- a/src/Templates/WebpackTemplateProvider.php +++ b/src/Templates/WebpackTemplateProvider.php @@ -79,7 +79,19 @@ class WebpackTemplateProvider implements TemplateGlobalProvider public static function mainTheme() { $themes = Config::inst()->get(SSViewer::class, 'themes'); - return is_array($themes) && $themes[0] !== '$public' && $themes[0] !== '$default' ? $themes[0] : false; + if (!is_array($themes)) { + return; + } + + $theme = null; + foreach ($themes as $t) { + if ($t !== '$public' && $t !== '$default') { + $theme = $t; + break; + } + } + + return $theme; } public static function resourcesURL($link = null): string