简体   繁体   中英

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:

  • editable(categories and subcategories) from sonata administration page.
  • imported in base_layout (page_bundle of sonata)

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM