Reputation: 695
I try to configure a custom admin menu in the sidebad of my Sonata Admin Bundle, but i don't understand how to ?
Thanks
Djoo
Upvotes: 5
Views: 10442
Reputation: 13167
For people that may be interested, a feature was added to manage the sidebar menu items (add or remove some of them) dynamically.
That mean you can easily have a condition based sidebar (i.e. display a different sidebar depending on (for instance) the role of the authenticated user).
The feature consists in an EventListener
listening on a custom ConfigureMenuEvent using KnpMenuBundle.
See extending the menu (KnpMenu Recipe of the SonataAdmin documentation) and the related chapter of the KnpMenuBundle official documentation.
Upvotes: 0
Reputation: 2206
The sidebar nav doesn't have a specific configuration, it uses the dashboard config to be generated.
To see it, you must be logged in and the user must have ROLE_SONATA_ADMIN to see the sidebar nav.
A related issue is explained here: https://github.com/sonata-project/SonataAdminBundle/issues/2321#issuecomment-52756483
Upvotes: 9