Allow settings navigation items with no route entrytags/v26.0.0beta3
@@ -15,7 +15,6 @@ | |||
<navigation> | |||
<id>user_status-menuitem</id> | |||
<name>User status</name> | |||
<route /> | |||
<order>1</order> | |||
<type>settings</type> | |||
</navigation> |
@@ -225,6 +225,11 @@ class InfoParser { | |||
* @return bool | |||
*/ | |||
private function isNavigationItem($data): bool { | |||
// Allow settings navigation items with no route entry | |||
$type = $data['type'] ?? 'link'; | |||
if ($type === 'settings') { | |||
return isset($data['name']); | |||
} | |||
return isset($data['name'], $data['route']); | |||
} | |||
@@ -301,10 +301,12 @@ 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'])) { | |||
// 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'; | |||
@@ -314,8 +316,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 { |
@@ -446,7 +446,7 @@ | |||
<xs:sequence> | |||
<xs:element name="id" type="id" minOccurs="0" maxOccurs="1"/> | |||
<xs:element name="name" type="non-empty-string" minOccurs="1" maxOccurs="1"/> | |||
<xs:element name="route" type="route" minOccurs="1" maxOccurs="1"/> | |||
<xs:element name="route" type="route" minOccurs="0" maxOccurs="1"/> | |||
<xs:element name="icon" type="xs:anyURI" minOccurs="0" maxOccurs="1"/> | |||
<xs:element name="order" type="xs:int" minOccurs="0" maxOccurs="1"/> | |||
<xs:element name="type" type="navigation-type" minOccurs="0" maxOccurs="1"/> |
@@ -442,7 +442,7 @@ | |||
<xs:sequence> | |||
<xs:element name="id" type="id" minOccurs="0" maxOccurs="1"/> | |||
<xs:element name="name" type="non-empty-string" minOccurs="1" maxOccurs="1"/> | |||
<xs:element name="route" type="route" minOccurs="1" maxOccurs="1"/> | |||
<xs:element name="route" type="route" minOccurs="0" maxOccurs="1"/> | |||
<xs:element name="icon" type="xs:anyURI" minOccurs="0" maxOccurs="1"/> | |||
<xs:element name="order" type="xs:int" minOccurs="0" maxOccurs="1"/> | |||
<xs:element name="type" type="navigation-type" minOccurs="0" maxOccurs="1"/> |