File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ class NavigationManager implements INavigationManager {
5757 protected ?string $ activeEntry = null ;
5858 /** @var array<string, NavigationEntryOutput> */
5959 protected array $ entries = [];
60- /** @var list<callable(): NavigationEntry> */
60+ /** @var list<callable(): ? NavigationEntry> */
6161 protected array $ closureEntries = [];
6262 /** User defined app order (cached for the `add` function) */
6363 protected ?array $ customAppOrder = null ;
@@ -357,7 +357,12 @@ private function resolveAppNavigationEntries(): void {
357357 // as apps might add new navigation entries via closures at any time
358358 while ($ c = array_pop ($ this ->closureEntries )) {
359359 try {
360- $ this ->add ($ c ());
360+ $ entry = $ c ();
361+ if ($ entry === null ) {
362+ $ this ->logger ->debug ('Closure of navigation entry returned null, skipping ' );
363+ continue ;
364+ }
365+ $ this ->add ($ entry );
361366 } catch (\Throwable $ e ) {
362367 $ this ->logger ->error ('Failed to add navigation entry from closure ' , ['exception ' => $ e ]);
363368 }
Original file line number Diff line number Diff line change @@ -80,7 +80,7 @@ interface INavigationManager {
8080 /**
8181 * Creates a new navigation entry
8282 *
83- * @param NavigationEntry|callable():NavigationEntry $entry If a menu entry (type = 'link') is added, you shall also set app to the app that
83+ * @param NavigationEntry|callable():? NavigationEntry $entry If a menu entry (type = 'link') is added, you shall also set app to the app that
8484 * added the entry. The use of a closure is preferred, because it will avoid loading
8585 * the routing of your app, unless required.
8686 * @return void
You can’t perform that action at this time.
0 commit comments