Skip to content

Render menu containing only siblings of active menu item #153

Description

@bkosborne

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:

Items
--> Bat
--> Ball
------> Large Ball
------> Medium Ball
------> Small Ball
--> Bottle

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:

{{ knp_menu_render(['AcmeDemoBundle:Builder:mainMenu', 'Items', 'Ball']) }}

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions