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

How to / menu #239

Closed
lionelbzv opened this issue Feb 1, 2016 · 2 comments
Closed

How to / menu #239

lionelbzv opened this issue Feb 1, 2016 · 2 comments

Comments

@lionelbzv
Copy link
Contributor

Recent lib update breaks something in menu construction: could you please explain the new way to override the main menu?

The cookbook way gives me now:

Type error: Argument 1 passed to Admingenerator\GeneratorBundle\Menu\AdmingeneratorMenuBuilder::__construct() must implement interface Knp\Menu\FactoryInterface, none given, called in /var/www/myproject/vendor/knplabs/knp-menu-bundle/Provider/BuilderAliasProvider.php on line 121

Thanks

@lionelbzv
Copy link
Contributor Author

here is my way, hope it's the good one :)

custom base_admin.html.twig

            {% block sidebar_menu %}
                {{ knp_menu_render('admingen_mysidebar') }}
            {% endblock %}

services.yml

    admingen.menu.default_builder:
        class: AdminBundle\Menu\AdminMenu
        arguments:
            - @knp_menu.factory
            - @request_stack
            - AdminHomepage
        tags:
            - { name: knp_menu.menu_builder, method: sidebarMenu, alias: admingen_mysidebar }

@sescandell
Copy link
Member

Hi @Lionel09

Yes, you need to create your menu as a service and define the right alias. This comes from #221 if I'm not wrong.

Documentation should be updated thanks to #223

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