Open pfpro opened 1 month ago
+1
One of my actions is a link to a different Symfony Controller, so the menu item is also not expandend/selected.
If you inject the AdminContextProvider
in that Controller you can manipulate the menuItem.
Something like this:
$context = $this->adminContextProvider->getContext();
$menuItems = $context->getMainMenu()->getItems();
foreach ($menuItems as $menuItem) {
if ($menuItem .... ) {
$menuItem->setExpanded(true);
foreach ($menuItem->getSubItems() as $subItem) {
if(...) {
$subItem->setSelected(true);
}
EasyAdmin: 4.11.1
Since the sidebar menu is now working again for normal use cases after the last EasyAdmin update, I would like to point out two problems with custom routes:
1 For the entity COMPANY, for example, I use my own DETAIL action in my own custom controller.
/admin?routeName=backend_crm_company_show&routeParams%5BentityId%5D=1
When I open this route, my parent menu entry (CRM) is neither expanded nor is the actual COMPANY menu entry highlighted.
In this case, is it necessary for me to manually open/highlight a menu entry? How would that work now? Or is there another approach?
2
In the former case, the menu opens correctly and an entry is highlighted - in the latter case, it does not.
Any help would be appreciated.