Browse Source

Allow settings navigation items with no route entry

Signed-off-by: Christopher Ng <chrng8@gmail.com>
tags/v26.0.0beta3
Christopher Ng 1 year ago
parent
commit
62b7bb7395
2 changed files with 11 additions and 3 deletions
  1. 4
    0
      lib/private/App/InfoParser.php
  2. 7
    3
      lib/private/NavigationManager.php

+ 4
- 0
lib/private/App/InfoParser.php View File

@@ -225,6 +225,10 @@ class InfoParser {
* @return bool
*/
private function isNavigationItem($data): bool {
// Allow settings navigation items with no route entry
if ($data['type'] === 'settings') {
return isset($data['name']);
}
return isset($data['name'], $data['route']);
}


+ 7
- 3
lib/private/NavigationManager.php View File

@@ -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 {

Loading…
Cancel
Save