diff options
author | Daniel Kesselberg <mail@danielkesselberg.de> | 2019-02-22 17:45:55 +0300 |
---|---|---|
committer | Backportbot <backportbot-noreply@rullzer.com> | 2019-02-27 18:09:36 +0300 |
commit | 70edd2b63342f1a5aee9dda4c8787a48a05cdab2 (patch) | |
tree | 498286c28745624547dfad0808a3ef01ff95ca74 /lib | |
parent | a05e578d363ac57769935a5f1431535935147d32 (diff) |
Parse multiple navigation items
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/App/InfoParser.php | 16 | ||||
-rw-r--r-- | lib/private/NavigationManager.php | 4 |
2 files changed, 16 insertions, 4 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 */ diff --git a/lib/private/NavigationManager.php b/lib/private/NavigationManager.php index 1874cd0e4ff..a1d3d252af1 100644 --- a/lib/private/NavigationManager.php +++ b/lib/private/NavigationManager.php @@ -271,10 +271,10 @@ class NavigationManager implements INavigationManager { // load plugins and collections from info.xml $info = $this->appManager->getAppInfo($app); - if (empty($info['navigations'])) { + if (!isset($info['navigations']['navigation'])) { continue; } - foreach ($info['navigations'] as $nav) { + foreach ($info['navigations']['navigation'] as $nav) { if (!isset($nav['name'])) { continue; } |