From 6444c06f68ec0949d2be8c2f3fe31b133560ce13 Mon Sep 17 00:00:00 2001 From: Fardel Pierre Date: Thu, 8 Oct 2026 14:55:51 +0200 Subject: [PATCH] fix(settings,admin): load the active theme instead of hardcoding default MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The OAuth account, OAuth provider, OAuth status, API registry and admin dashboard controllers built their stylesheet URLs as "$themesUri . '/default/…'", so these pages always rendered with the default theme, and never loaded the scripts a theme declares in $theme_scripts. Use ViewModeConfigurator::addThemeStylesheets() and addThemeScripts() (horde/Core), which resolve the user's theme and walk the regular asset cascade. Themes that do not ship settings.css or admin-dashboard.css keep inheriting the default ones. --- src/Admin/AdminDashboardController.php | 8 +++++--- src/Admin/ApiRegistryController.php | 8 +++++--- src/Admin/OAuthProviderController.php | 8 +++++--- src/Admin/OAuthSystemStatusController.php | 8 +++++--- src/Settings/OAuthAccountController.php | 8 +++++--- 5 files changed, 25 insertions(+), 15 deletions(-) diff --git a/src/Admin/AdminDashboardController.php b/src/Admin/AdminDashboardController.php index 1f8e5f46..993f5b00 100644 --- a/src/Admin/AdminDashboardController.php +++ b/src/Admin/AdminDashboardController.php @@ -150,10 +150,12 @@ private function createView(): Horde_View private function renderChrome(string $title, callable $renderBody): string { - $themesUri = $this->registry->get('themesuri', 'horde'); - $this->assetCollector->addStylesheet($themesUri . '/default/screen.css'); - $this->assetCollector->addStylesheet($themesUri . '/default/admin-dashboard.css'); + $this->configurator->addThemeStylesheets( + $this->assetCollector, + ['screen.css', 'admin-dashboard.css'], + ); $this->configurator->configure($this->assetCollector, ViewMode::BASIC); + $this->configurator->addThemeScripts($this->assetCollector); $meta = new PageMeta(title: $title); $html = $this->pageComposer->renderHead($meta); diff --git a/src/Admin/ApiRegistryController.php b/src/Admin/ApiRegistryController.php index 722b19df..c255d454 100644 --- a/src/Admin/ApiRegistryController.php +++ b/src/Admin/ApiRegistryController.php @@ -139,10 +139,12 @@ private function createView(): Horde_View private function renderChrome(string $title, callable $renderBody, string $currentUrl): string { - $themesUri = $this->registry->get('themesuri', 'horde'); - $this->assetCollector->addStylesheet($themesUri . '/default/screen.css'); - $this->assetCollector->addStylesheet($themesUri . '/default/settings.css'); + $this->configurator->addThemeStylesheets( + $this->assetCollector, + ['screen.css', 'settings.css'], + ); $this->configurator->configure($this->assetCollector, ViewMode::BASIC); + $this->configurator->addThemeScripts($this->assetCollector); $meta = new PageMeta(title: $title); $html = $this->pageComposer->renderHead($meta); diff --git a/src/Admin/OAuthProviderController.php b/src/Admin/OAuthProviderController.php index e5395425..eedeef8f 100644 --- a/src/Admin/OAuthProviderController.php +++ b/src/Admin/OAuthProviderController.php @@ -411,10 +411,12 @@ private function createView(): Horde_View private function renderChrome(string $title, callable $renderBody, string $currentUrl): string { - $themesUri = $this->registry->get('themesuri', 'horde'); - $this->assetCollector->addStylesheet($themesUri . '/default/screen.css'); - $this->assetCollector->addStylesheet($themesUri . '/default/settings.css'); + $this->configurator->addThemeStylesheets( + $this->assetCollector, + ['screen.css', 'settings.css'], + ); $this->configurator->configure($this->assetCollector, ViewMode::BASIC); + $this->configurator->addThemeScripts($this->assetCollector); $meta = new PageMeta(title: $title); $html = $this->pageComposer->renderHead($meta); diff --git a/src/Admin/OAuthSystemStatusController.php b/src/Admin/OAuthSystemStatusController.php index 0ae252c5..59589c04 100644 --- a/src/Admin/OAuthSystemStatusController.php +++ b/src/Admin/OAuthSystemStatusController.php @@ -121,10 +121,12 @@ private function createView(): Horde_View private function renderChrome(string $title, callable $renderBody, string $currentUrl): string { - $themesUri = $this->registry->get('themesuri', 'horde'); - $this->assetCollector->addStylesheet($themesUri . '/default/screen.css'); - $this->assetCollector->addStylesheet($themesUri . '/default/settings.css'); + $this->configurator->addThemeStylesheets( + $this->assetCollector, + ['screen.css', 'settings.css'], + ); $this->configurator->configure($this->assetCollector, ViewMode::BASIC); + $this->configurator->addThemeScripts($this->assetCollector); $meta = new PageMeta(title: $title); $html = $this->pageComposer->renderHead($meta); diff --git a/src/Settings/OAuthAccountController.php b/src/Settings/OAuthAccountController.php index 2262eae7..7b744548 100644 --- a/src/Settings/OAuthAccountController.php +++ b/src/Settings/OAuthAccountController.php @@ -639,10 +639,12 @@ private function createView(): Horde_View private function renderChrome(string $title, callable $renderBody): string { - $themesUri = $this->registry->get('themesuri', 'horde'); - $this->assetCollector->addStylesheet($themesUri . '/default/screen.css'); - $this->assetCollector->addStylesheet($themesUri . '/default/settings.css'); + $this->configurator->addThemeStylesheets( + $this->assetCollector, + ['screen.css', 'settings.css'], + ); $this->configurator->configure($this->assetCollector, ViewMode::BASIC); + $this->configurator->addThemeScripts($this->assetCollector); $meta = new PageMeta(title: $title); $html = $this->pageComposer->renderHead($meta);