diff options
Diffstat (limited to 'lib/private/TemplateLayout.php')
-rw-r--r-- | lib/private/TemplateLayout.php | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/lib/private/TemplateLayout.php b/lib/private/TemplateLayout.php index 4e633bf8b06..4b53af37679 100644 --- a/lib/private/TemplateLayout.php +++ b/lib/private/TemplateLayout.php @@ -81,6 +81,12 @@ class TemplateLayout extends \OC_Template { /** @var IInitialStateService */ $this->initialState = \OC::$server->get(IInitialStateService::class); + // Add fallback theming variables if theming is disabled + if (!\OC::$server->getAppManager()->isEnabledForUser('theming')) { + // TODO cache generated default theme if enabled for fallback if server is erroring ? + Util::addStyle('theming', 'default'); + } + // Decide which page we show if ($renderAs === TemplateResponse::RENDER_AS_USER) { /** @var INavigationManager */ @@ -99,6 +105,13 @@ class TemplateLayout extends \OC_Template { $this->initialState->provideInitialState('unified-search', 'live-search', $this->config->getAppValue('core', 'unified-search.live-search', 'yes') === 'yes'); Util::addScript('core', 'unified-search', 'core'); + // Set body data-theme + if (\OC::$server->getAppManager()->isEnabledForUser('theming') && class_exists('\OCA\Theming\Service\ThemesService')) { + /** @var \OCA\Theming\Service\ThemesService */ + $themesService = \OC::$server->get(\OCA\Theming\Service\ThemesService::class); + $this->assign('enabledThemes', $themesService->getEnabledThemes()); + } + // set logo link target $logoUrl = $this->config->getSystemValueString('logo_url', ''); $this->assign('logoUrl', $logoUrl); @@ -141,17 +154,6 @@ class TemplateLayout extends \OC_Template { $this->assign('userAvatarSet', true); $this->assign('userAvatarVersion', $this->config->getUserValue(\OC_User::getUser(), 'avatar', 'version', 0)); } - - // check if app menu icons should be inverted - try { - /** @var \OCA\Theming\Util $util */ - $util = \OC::$server->query(\OCA\Theming\Util::class); - $this->assign('themingInvertMenu', $util->invertTextColor(\OC::$server->getThemingDefaults()->getColorPrimary())); - } catch (\OCP\AppFramework\QueryException $e) { - $this->assign('themingInvertMenu', false); - } catch (\OCP\AutoloadNotAllowedException $e) { - $this->assign('themingInvertMenu', false); - } } elseif ($renderAs === TemplateResponse::RENDER_AS_ERROR) { parent::__construct('core', 'layout.guest', '', false); $this->assign('bodyid', 'body-login'); |