summaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
authorJohn Molakvoæ <skjnldsv@users.noreply.github.com>2022-04-22 12:32:14 +0200
committerGitHub <noreply@github.com>2022-04-22 12:32:14 +0200
commit9a76f06ecadf05ef1d26bd735df1bea0dfb15d59 (patch)
treeebdd458b0969c07d5ce77b21684a8bdf1db8434d /lib/private
parente1cb1bdce94fa2a6395b2d3a35556944111e66b1 (diff)
parent850d8ac1cd9e5b28e37668469237d8daa5c5d51d (diff)
downloadnextcloud-server-9a76f06ecadf05ef1d26bd735df1bea0dfb15d59.tar.gz
nextcloud-server-9a76f06ecadf05ef1d26bd735df1bea0dfb15d59.zip
Merge pull request #31751 from nextcloud/theming-providers
Diffstat (limited to 'lib/private')
-rw-r--r--lib/private/TemplateLayout.php24
-rw-r--r--lib/private/legacy/OC_Template.php2
2 files changed, 14 insertions, 12 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');
diff --git a/lib/private/legacy/OC_Template.php b/lib/private/legacy/OC_Template.php
index 16ad7273cd2..b7a400d3269 100644
--- a/lib/private/legacy/OC_Template.php
+++ b/lib/private/legacy/OC_Template.php
@@ -105,7 +105,7 @@ class OC_Template extends \OC\Template\Base {
// apps that started before the template initialization can load their own scripts/styles
// so to make sure this scripts/styles here are loaded first we put all core scripts first
// check lib/public/Util.php
- OC_Util::addStyle('css-variables', null, true);
+ // OC_Util::addStyle('css-variables', null, true);
OC_Util::addStyle('server', null, true);
// include common nextcloud webpack bundle