diff options
author | Daniel Kesselberg <mail@danielkesselberg.de> | 2019-02-22 15:45:55 +0100 |
---|---|---|
committer | Daniel Kesselberg <mail@danielkesselberg.de> | 2019-02-22 15:57:14 +0100 |
commit | 36c51bc4f160d8b18de64739e9ffccccee8a5b25 (patch) | |
tree | a7ed5edf4aa085a8c36792993a7be8caffe681cb /lib/private/App | |
parent | 2083103d0ba8ce41489632ebe240f6dde51baccc (diff) | |
download | nextcloud-server-36c51bc4f160d8b18de64739e9ffccccee8a5b25.tar.gz nextcloud-server-36c51bc4f160d8b18de64739e9ffccccee8a5b25.zip |
Parse multiple navigation items
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
Diffstat (limited to 'lib/private/App')
-rw-r--r-- | lib/private/App/InfoParser.php | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/private/App/InfoParser.php b/lib/private/App/InfoParser.php index e0ed63fc784..ef96156dfed 100644 --- a/lib/private/App/InfoParser.php +++ b/lib/private/App/InfoParser.php @@ -52,7 +52,7 @@ class InfoParser { return null; } - if(!is_null($this->cache)) { + if ($this->cache !== null) { $fileCacheKey = $file . filemtime($file); if ($cachedValue = $this->cache->get($fileCacheKey)) { return json_decode($cachedValue, true); @@ -205,13 +205,25 @@ class InfoParser { $array['settings']['personal-section'] = [$array['settings']['personal-section']]; } - if(!is_null($this->cache)) { + if (isset($array['navigations']['navigation']) && $this->isNavigationItem($array['navigations']['navigation'])) { + $array['navigations']['navigation'] = [$array['navigations']['navigation']]; + } + + if ($this->cache !== null) { $this->cache->set($fileCacheKey, json_encode($array)); } return $array; } /** + * @param $data + * @return bool + */ + private function isNavigationItem($data): bool { + return isset($data['name'], $data['route']); + } + + /** * @param \SimpleXMLElement $xml * @return array */ |