Set up the menu in the set of admin sonatas

I am trying to set up a custom admin menu in the sidebar of my Admin Bundle Sonata, but I don’t understand how to do this?

thanks

Djoo

+5
source share
2 answers

There is no specific configuration in the sidebar navigation bar; it uses the configuration of the dashboard that needs to be generated.

To see this, you must be logged in and the user must have ROLE_SONATA_ADMIN to see the navigation in the sidebar.

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

+9
source

For people who may be interested, a function has been added to manage the sidebar menu items (add or remove some of them) dynamically .

This means that you can easily have a state-based sidebar (that is, display a different sidebar depending on (for example) the role of the authenticated user).

The function is to listen to the EventListener in the custom ConfigureMenuEvent using KnpMenuBundle.

See the menu extension (KnpMenu recipe for SonataAdmin documentation) and the corresponding chapter in the KnpMenuBundle official documentation .

0
source

Source: https://habr.com/ru/post/1200207/


All Articles