Browse Source

Fallback to the default theme

if the configured one doesn't exist, fallback to "Default"
Belle Aerni 2 years ago
parent
commit
d6588573b0
1 changed files with 5 additions and 0 deletions
  1. 5 0
      src/AntCMS/AntCMS.php

+ 5 - 0
src/AntCMS/AntCMS.php

@@ -98,6 +98,11 @@ class AntCMS
     {
     {
         $currentConfig = AntConfig::currentConfig();
         $currentConfig = AntConfig::currentConfig();
         $theme = $theme ?? $currentConfig['activeTheme'];
         $theme = $theme ?? $currentConfig['activeTheme'];
+
+        if (!is_dir(antThemePath . '/' . $theme)) {
+            $theme = 'Default';
+        }
+
         $templatePath = antThemePath . '/' . $theme . '/' . 'Templates';
         $templatePath = antThemePath . '/' . $theme . '/' . 'Templates';
         $defaultTemplates = antThemePath . '/Default/Templates';
         $defaultTemplates = antThemePath . '/Default/Templates';