diff options
author | Morris Jobke <hey@morrisjobke.de> | 2017-05-17 10:42:41 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-17 10:42:41 -0500 |
commit | 2ec616323b9ce83a8b8a0347b069991696198aeb (patch) | |
tree | a6f9741a134459a001d015f67b9cf7a06062ef7f /apps/theming/lib | |
parent | e3322634a2ddd96ae454d1796fcaf46769a885ec (diff) | |
parent | 81847c01b014bf609e7d5597b2d81efe5973b0a5 (diff) | |
download | nextcloud-server-2ec616323b9ce83a8b8a0347b069991696198aeb.tar.gz nextcloud-server-2ec616323b9ce83a8b8a0347b069991696198aeb.zip |
Merge pull request #4918 from nextcloud/theming-capabilities-plain-background
OCS Return color when theming uses no background image
Diffstat (limited to 'apps/theming/lib')
-rw-r--r-- | apps/theming/lib/Capabilities.php | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/apps/theming/lib/Capabilities.php b/apps/theming/lib/Capabilities.php index 2a9e9a3c6cf..6e098940ff1 100644 --- a/apps/theming/lib/Capabilities.php +++ b/apps/theming/lib/Capabilities.php @@ -24,6 +24,7 @@ namespace OCA\Theming; use OCP\Capabilities\ICapability; +use OCP\IConfig; use OCP\IURLGenerator; /** @@ -36,17 +37,21 @@ class Capabilities implements ICapability { /** @var ThemingDefaults */ protected $theming; - /** @var IURLGenerator */ protected $url; + /** @var IConfig */ + protected $config; + /** * @param ThemingDefaults $theming * @param IURLGenerator $url + * @param IConfig $config */ - public function __construct(ThemingDefaults $theming, IURLGenerator $url) { + public function __construct(ThemingDefaults $theming, IURLGenerator $url, IConfig $config) { $this->theming = $theming; $this->url = $url; + $this->config = $config; } /** @@ -55,6 +60,8 @@ class Capabilities implements ICapability { * @return array */ public function getCapabilities() { + $backgroundLogo = $this->config->getAppValue('theming', 'backgroundMime', false); + return [ 'theming' => [ 'name' => $this->theming->getName(), @@ -62,7 +69,9 @@ class Capabilities implements ICapability { 'slogan' => $this->theming->getSlogan(), 'color' => $this->theming->getColorPrimary(), 'logo' => $this->url->getAbsoluteURL($this->theming->getLogo()), - 'background' => $this->url->getAbsoluteURL($this->theming->getBackground()), + 'background' => $backgroundLogo === 'backgroundColor' ? + $this->theming->getColorPrimary() : + $this->url->getAbsoluteURL($this->theming->getBackground()), ], ]; } |