From 84e473e6a91437bed03a29859535276623ea38fc Mon Sep 17 00:00:00 2001 From: "Beau Beauchamp, WebTigers" Date: Fri, 2 Oct 2026 10:27:57 -0400 Subject: [PATCH] CMS home-page picker: list only ACTIVATED themes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cms_Service_Paths enumerated Tiger_Theme::inventory() — every INSTALLED theme, active or not — so the home-page selector offered pages from deactivated theme modules, letting / be pointed at a theme that isn't on (how a stale @theme:grey-mist home got set). The picker now skips a theme whose module (theme-) is in Tiger_Model_Module::inactiveSlugs(); plain themes/ themes (no module to deactivate) stay available. Reuses the Tiger_Code_Modules inactive-slugs pattern. Selector-only — the stored value, its label resolution, and themeContentAction are untouched. Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_01ASauLLscjqdsNqBNsx2Typ --- modules/cms/services/Paths.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/modules/cms/services/Paths.php b/modules/cms/services/Paths.php index 2249f9a..fd4646f 100644 --- a/modules/cms/services/Paths.php +++ b/modules/cms/services/Paths.php @@ -119,7 +119,16 @@ protected static function _discover(bool $advanced, string $q): array $themes = []; $themeHome = self::_t('cms.settings.theme_home'); $inv = Tiger_Theme::inventory(); + // Only ACTIVATED themes belong in the picker — you can't serve a page from a theme that's turned + // off. A theme that ships as a MODULE (modules/theme-) must have its module active; a plain + // themes/ theme has no module to deactivate, so it's always available. + $inactiveMods = []; + try { $inactiveMods = array_flip((new Tiger_Model_Module())->inactiveSlugs()); } catch (Throwable $e) {} + $themeActive = function ($key, $dir) use ($inactiveMods) { + return strpos((string) $dir, '/modules/theme-') === false || !isset($inactiveMods['theme-' . $key]); + }; foreach ($inv as $key => $t) { + if (!$themeActive($key, $t['dir'])) { continue; } if (is_file($t['dir'] . '/content/index.phtml')) { $label = $t['name'] . ' — ' . $themeHome; $value = '@theme:' . $key; @@ -128,6 +137,7 @@ protected static function _discover(bool $advanced, string $q): array } if ($advanced) { foreach ($inv as $key => $t) { + if (!$themeActive($key, $t['dir'])) { continue; } foreach (Tiger_Theme::pagesForKey($key) as $pg) { if ($pg['slug'] === 'index') { continue; } // the home is already listed above $label = $t['name'] . ' — ' . $pg['title'];