Open bkosborne opened 10 years ago
Can you give an example where it can be useful ?
I'm trying to imagine "why".
Notice that there's an easy way to do but we were talking about deleting it because it's a problem in the code to implemente more cool things.
Sure. I want to limit my main nav bar to just show two levels of depth in the menu, but the menu may be much deeper. When someone is on one of those pages, I want to introduce another navigation in a sidebar that contains the remaining pages.
Here's an example of a website that does it: http://www.bu.edu/cs/undergraduate/computer-science-major
The main menu on the top contains two levels of items. But if you click on Undergraduate for instance, there's a new nav on the right that contains remaining children.
Has anyone figure out how to do this or is a custom template required? It appears I can limit the depth in using the depth
option but I can not start at a specific depth. With knp_menu_get_current_item()
I can start at the depth of the current page but I would like to always start the second depth of the root. Also what does matchingDepth
actually do? I can't find any doc on it and it appears to do nothing at all.
I also need this and it seems there is no really alternative to knpmenu on symfony. I also can't find out what matchingDepth does. Has anyone found a solution in this 5 years the bug is open now?
I also can't find out what matchingDepth does.
See https://github.com/KnpLabs/KnpMenu/blob/master/doc/01-Basic-Menus.md#other-rendering-options
matchingDepth: The depth of the scan to determine whether an item is an ancestor of the current item
I'm curious, is there a way to render a partial menu containing siblings (and maybe children) of the current menu item?
Given a menu tree:
If the user is on the
Large Ball
page, I'd like to be able to render all siblings. In my real case, they would be rendered as tabs.84 may be the same thing, but it seems like that use case is actually rendering all the ancestors as well.
It seems I can do this:
But that would require that I know the name of the current menu item. If I can get that in twig somehow, I guess that would be fine and I could just fill it in there, but ideally there'd be some baked in functionality to support rendering sub-trees.