FIX: Theme detection

This commit is contained in:
Tony Air 2024-04-30 14:23:25 +02:00
parent 04405b1ba3
commit a3c4e19f95

View File

@ -79,7 +79,19 @@ class WebpackTemplateProvider implements TemplateGlobalProvider
public static function mainTheme() public static function mainTheme()
{ {
$themes = Config::inst()->get(SSViewer::class, 'themes'); $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 public static function resourcesURL($link = null): string