djoo
djoo

Reputation: 695

Configure Menu in Sonata Admin Bundle

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

Answers (2)

chalasr
chalasr

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

HypeR
HypeR

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.

https://github.com/antoinemineau/SonataAdminBundle/blob/master/Resources/views/standard_layout.html.twig#L181

A related issue is explained here: https://github.com/sonata-project/SonataAdminBundle/issues/2321#issuecomment-52756483

Upvotes: 9

Related Questions