Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get children of active Menu Item #156

Open
DanielFatkic opened this issue Nov 16, 2012 · 4 comments
Open

Get children of active Menu Item #156

DanielFatkic opened this issue Nov 16, 2012 · 4 comments

Comments

@DanielFatkic
Copy link

Is there a way to get the children from the active item automatic?
If not, i'd like to suggest this for the future:)

It would be nice to be able to create submenus (2 line navigation) like here: http://www.xendach.de/

If you check the navigation, you see that there are 4 parent items and when you hover the parent, you see the children AND you also see the current items childs under the main main

e.g. something like this pseudocode would be nice:)

<div class="navbar-inner">
   {{ knp_menu_render('RFWCoreBundle:Builder:mainMenu', {'currentClass': 'active', 'template': 'RFWCoreBundle:Menu:knp_menu.html.twig'}) }}
</div>

<div class="submenu">
{% set active = knp%}
{% set menuItem2 = knp_menu_get('RFWCoreBundle:Builder:mainMenu', {from: 'current', 'currentClass': 'active','template': 'RFWCoreBundle:Menu:submenu.html.twig'}) %}

        {{ knp_menu_render(menuItem2) }}
</div>
@hpatoio
Copy link

hpatoio commented Jan 24, 2013

I'm trying to do this too ... anyone ?

@Mopster
Copy link

Mopster commented Jan 30, 2013

I did something like this for my tree menu. I wanted to render my tree from sub menu items of the current active top menu item.

{% set menu = knp_menu_get('menu') %}
{% set topmenuitem = admin_menu_top(menu, 1) %}
{% if topmenuitem %}
            {{ knp_menu_render([menu, topmenuitem.name], { 'template': 'KunstmaanAdminBundle:Menu:knp_menu_treemenu.html.twig'}, 'bootstrap') }}
{% endif %}

To get the current topmenu item using 'admin_menu_top', I made the following TwigExtenstion : https://github.com/Kunstmaan/KunstmaanAdminBundle/blob/knpmenu/Twig/MenuTwigExtension.php

Hope this'll help you a bit.

@Nek-
Copy link
Contributor

Nek- commented Jul 4, 2014

Hello, the Voter feature is not enough fo you ? Why ?

@shahzadthathal
Copy link

Hi,

Is there any way to do this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants