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

Improve menu for dynamic links #78

Closed
Cryde opened this issue Nov 13, 2012 · 3 comments
Closed

Improve menu for dynamic links #78

Cryde opened this issue Nov 13, 2012 · 3 comments

Comments

@Cryde
Copy link

Cryde commented Nov 13, 2012

Hello

I just want to know how can I use the KnpMenu with 'dynamic' link ?
When I do this (I work with Symfony2) :

    public function mainMenu(FactoryInterface $factory, array $options)
    {
        $menu = $factory->createItem('root');

        $menu->addChild('Menu 1', array('route' => '_route_1'));
        $menu->addChild('Menu 2', array('route' => '_route_2'));

        $menu['Menu 1']->addChild('Submenu 1', array(
                        'route' => '_route_submenu_1',
                        'routeParameters' => array('slug' => 'fake_slug_param')));
        $menu['Menu 1']['Submenu 1']->addChild('Another submenu', array(
                        'route' => '_another_route',
                        'routeParameters' => array('slug' => 'another_fake_param')));

        return $menu;
    }

And after render it :

{{ knp_menu_render('MAHomeBundle:Builder:mainMenu') }}

How can I just display the first level and keep the 'current' status propagation of the children ?

If I do that :

{{ knp_menu_render('MAHomeBundle:Builder:mainMenu', {'depth': 1}) }}

Only "Menu 1" and "Menu 2" will be display BUT if I am on the page with route "_another_route", "Menu 1" will not have 'current_ancestor' class ...

Is there a solution?

Ps : sorry for my bad english ...

@ghost
Copy link

ghost commented Apr 21, 2013

@Cryde : this seems covered under the discussion in #26: if that's the case can you close this issue?

@ghost
Copy link

ghost commented Apr 21, 2013

oh.. also #96

@ghost
Copy link

ghost commented Jun 23, 2013

@stof: can you close the issue ?

@pilot pilot closed this as completed Jun 23, 2013
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

2 participants