Custom KnpMenuBundle TwigRenderer in Symfony2

355 views Asked by At

I'm coding a Symfony2 project. I'm using KnpMenuBundle and Twitter Bootstrap 3. What's wrong is KnpMenuBundle doesn't generate the good classes for my menu. I got class="current" instead of class="active".

I look for what to do and here is what I've already done:

  1. I copied TwigRender from KnpMenu into a Renderer directory and I changed currentClass attributes in the construct method.
  2. I had my menu builder and my custom renderer to be services.
  3. I tried to rendered it.

But I get this exeption

An exception has been thrown during the rendering of a template ("Catchable Fatal Error: Argument 1 passed to Acme\MenuBundle\Renderer\CustomRenderer::__construct() must be an instance of Twig_Environment, string given, called in /var/www/project1/app/cache/dev/appDevDebugProjectContainer.php on line 1337 and defined in /var/www/project1/src/Acme/MenuBundle/Renderer/CustomRenderer.php line 24") in "AcmeHelloBundle:Default:index.html.twig".

I wish you'll be able to help me.

Chronic.

PS: excuse-me for the way I speak but I'm not a English native speaker ;)

0

There are 0 answers