symfonysymfony-sonata

Symfony2 with custom menu integrated with sonata


I have a custom menu, it is not created via symfony2 knp or other bundle and I don't want it to be created via those methods.

I need this menu to be:

And this menu needs to have active links, so I need to pass to it which page the user is on.

My question is how can I get this done?


Solution

  • I think you could create a menu through KnpMenu nonetheless. By using a Custom Menu Provider you could retrieve the menu entries from the database (you'd need to create an entity to store it) depending on the active page.

    KnpMenu can facilitate the rendering of your menu; SonataAdmin can facilitate the edition of those. You'll need to create a custom admin class for your entity, but that should do it.

    Hope it helps.