EasyAdminBundle
EasyAdminBundle copied to clipboard
Sub-menu items selection
Describe the bug
After refactoring of MenuItemMatcherInterface the bug appears with sub-items.
Earlier, EasyAdmin called isSelected even on the sub-items:
https://github.com/EasyCorp/EasyAdminBundle/blob/328cd8190bbaf84ad79fce138776f67cff10487a/src/Factory/MenuFactory.php#L102
After refactoring, this line was removed and only being called on main menus: https://github.com/EasyCorp/EasyAdminBundle/blob/d21c3222a660f6aa9748623e53db8be5d8d98e78/src/Factory/MenuFactory.php#L90
To Reproduce Use version < 4.11 and have sub-menu items. Upgrade to >= 4.11 version and sub-menus would not have sub-menu items selected and later on expanded.
Solution: Add the lines:
$adminContext = $this->adminContextProvider->getContext();
$subItems = $this->menuItemMatcher->markSelectedMenuItem($subItems, $adminContext->getRequest());