File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -26,33 +26,27 @@ public function getItems(): Collection
2626 {
2727 return $ this ->menu ()
2828 ?->items()
29- ->filter (function (SharpMenuItem $ item ) {
30- if ($ item ->isSection ()) {
31- return count ($ this ->resolveSectionItems ($ item )) > 0 ;
32- }
33-
34- return $ item ->isAllowed ();
35- }) ?? collect ();
29+ ->filter (fn (SharpMenuItem $ item ) => $ item ->isSection ()
30+ ? count ($ this ->resolveSectionItems ($ item )) > 0
31+ : $ item ->isAllowed ()
32+ ) ?? collect ();
3633 }
3734
3835 public function getFlattenedItems (): Collection
3936 {
4037 return $ this ->getItems ()
41- ->map (function (SharpMenuItem $ item ) {
42- return $ item -> isSection ( )
43- ? $ this -> resolveSectionItems ( $ item)
44- : $ item ;
45- } )
38+ ->map (fn (SharpMenuItem $ item ) => $ item -> isSection ()
39+ ? $ this -> resolveSectionItems ( $ item )
40+ : $ item
41+ )
42+ -> merge ( $ this -> userMenu ()?->getItems() ?? collect () )
4643 ->flatten ();
4744 }
4845
4946 public function getEntityMenuItem (string $ entityKey ): ?SharpMenuItemLink
5047 {
5148 return $ this ->getFlattenedItems ()
52- ->first (function (SharpMenuItem $ item ) use ($ entityKey ) {
53- return $ item ->isEntity ()
54- && $ item ->getEntityKey () === $ entityKey ;
55- });
49+ ->first (fn (SharpMenuItem $ item ) => $ item ->isEntity () && $ item ->getEntityKey () === $ entityKey );
5650 }
5751
5852 public function resolveSectionItems (SharpMenuItemSection $ section ): Collection
You can’t perform that action at this time.
0 commit comments