Anyone know a good principle or maybe a bundle for dealing with navigation menus in symfony2?
I've tried the Knp bundle, but it's just setters and getters. I though of a functionality where controllers will match my main menu, actions will match the submenu and additional parameters could be mapped to a sub-sub menu.
I thought that I could make my application that each entry in my main menu will relate to a XController.php
and each entry in the submenu under it will relate to an xAction
in the same controller. Knp is quite flexible, but (as far as I understand) does not support such mapping.
The main navigation entry should be active when we are in the related Controller no matter of the action or any other parameters. And here's the problem. In symfony's config you have _controller: ABBundle:NameController:nameAction
, extracting the controller and action name from which is quite heavy, and not a good idea to run on every page load. If I match the whole _controller string then my main menu entries wont be active independant of the action..
Also I thought even breadcrumbs could be generated by this schema, the first link would be a copy of the active link from the main navigation, the second could be the active entry of the sub navigation menu and the rest could be set via the controller according to logic.
Any ideas?