diff options
author | Christopher Ng <chrng8@gmail.com> | 2023-02-02 17:11:17 -0800 |
---|---|---|
committer | Christopher Ng <chrng8@gmail.com> | 2023-02-02 17:11:17 -0800 |
commit | 62b7bb73955a6f782ddaf6e3d248f29b93165099 (patch) | |
tree | 18f6da22c71fbeef086a12eb1d6aa9783dec19bb /lib/private/NavigationManager.php | |
parent | e81cb6eaf0274dcdf2402de16216e8c61826235e (diff) | |
download | nextcloud-server-62b7bb73955a6f782ddaf6e3d248f29b93165099.tar.gz nextcloud-server-62b7bb73955a6f782ddaf6e3d248f29b93165099.zip |
Allow settings navigation items with no route entry
Signed-off-by: Christopher Ng <chrng8@gmail.com>
Diffstat (limited to 'lib/private/NavigationManager.php')
-rw-r--r-- | lib/private/NavigationManager.php | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/private/NavigationManager.php b/lib/private/NavigationManager.php index b78d9fa1ed8..2d1400714fe 100644 --- a/lib/private/NavigationManager.php +++ b/lib/private/NavigationManager.php @@ -301,11 +301,15 @@ class NavigationManager implements INavigationManager { continue; } foreach ($info['navigations']['navigation'] as $key => $nav) { + $nav['type'] = $nav['type'] ?? 'link'; if (!isset($nav['name'])) { continue; } if (!isset($nav['route'])) { - continue; + // Allow settings navigation items with no route entry, all other types require one + if ($nav['type'] !== 'settings') { + continue; + } } $role = isset($nav['@attributes']['role']) ? $nav['@attributes']['role'] : 'all'; if ($role === 'admin' && !$this->isAdmin()) { @@ -314,8 +318,8 @@ class NavigationManager implements INavigationManager { $l = $this->l10nFac->get($app); $id = $nav['id'] ?? $app . ($key === 0 ? '' : $key); $order = isset($nav['order']) ? $nav['order'] : 100; - $type = isset($nav['type']) ? $nav['type'] : 'link'; - $route = $nav['route'] !== '' ? $this->urlGenerator->linkToRoute($nav['route']) : ''; + $type = $nav['type']; + $route = !empty($nav['route']) ? $this->urlGenerator->linkToRoute($nav['route']) : ''; $icon = isset($nav['icon']) ? $nav['icon'] : 'app.svg'; foreach ([$icon, "$app.svg"] as $i) { try { |