fix(appinfo): navigation type is optional

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2023-02-03 09:52:37 +01:00
parent c610d0d99b
commit bf7fe04c4b
No known key found for this signature in database
GPG key ID: 74434EFE0D2E2205
2 changed files with 5 additions and 6 deletions

View file

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

View file

@ -305,11 +305,9 @@ class NavigationManager implements INavigationManager {
if (!isset($nav['name'])) {
continue;
}
if (!isset($nav['route'])) {
// Allow settings navigation items with no route entry, all other types require one
if ($nav['type'] !== 'settings') {
continue;
}
// Allow settings navigation items with no route entry, all other types require one
if (!isset($nav['route']) && $nav['type'] !== 'settings') {
continue;
}
$role = isset($nav['@attributes']['role']) ? $nav['@attributes']['role'] : 'all';
if ($role === 'admin' && !$this->isAdmin()) {