Questions tagged [knpmenubundle]

The KnpMenuBundle integrates the KnpMenu PHP library with Symfony2.

The KnpMenuBundle integrates the KnpMenu PHP library with Symfony2.

Once is integrated with Symfony, you can use 2 differents ways to build a menu:

  1. the "easy" way (basically the same as KnpMenu when using it as a stand alone library)
  2. and the more flexible method using a service.

Useful links:

122 questions
2
votes
1 answer

Symfony KnpMenuBundle configuration across bundles

I'm using KnpMenuBudle in two different bundles of the same application. In one bundle I use also BraincraftedBootstrapBundle, so in my app/config/config.yml I put this specific config to style menus with bootstrap: knp_menu: twig: template:…
Manuel Bitto
  • 5,073
  • 6
  • 39
  • 47
1
vote
0 answers

How can I remove "default" item from knp menu in Sonata?

Whenever I create a new admin class for an entity in Sonata, the knp side menu creates a new group called "default" with children that corresponds to the entity items. The same goes in the upper navbar when you click on the "plus" icon to display…
1
vote
1 answer

symfony6 install KnpMenuBundle

I want to install KnpMenuBundle into an empty Symfony project (--webapp project). I make steps from KnpMenuBundle documentation but it does not work. configuration symfony 6.1.7 KnpMenuBundle downloaded: 3.2 Here are my different…
redrabbit
  • 41
  • 5
1
vote
1 answer

How to addChild to special position (order) KNP Menu

Is there a way to addChild not on the end of the menu? If I have: Red Green Yellow And I want add blue before Yellow? $menu = $event->getMenu(); $menu->getChild('colors') ->addChild('blue', [ 'route' => 'blue_link', …
M. F
  • 77
  • 9
1
vote
1 answer

Override Knp menu template

I would like to use my own template to create my custom website menu with Knp Menu. I find how to specify a different template, using this: {{ knp_menu_render('main', {'template' : 'custom_knp_menu.html.twig'}) }} But now, I have no idea how to…
Minirock
  • 628
  • 3
  • 13
  • 28
1
vote
1 answer

knpMenuBundle symfony 4

I try use knpMenuBundle in symfony 4 I render {{ knp_menu_render('App:MenuBuilder:menuTags') }} class is in src/ App\Menu\MenuBuilder get An exception has been thrown during the rendering of a template ("Bundle "App" does not exist or it is…
Developer
  • 2,731
  • 2
  • 41
  • 71
1
vote
2 answers

composer cannot install knp menu bundle in symfony 3.4

I tried to install the knp-menu-bundle in Symfony 3.4 but I got the following error: $ composer require knplabs/knp-menu-bundle dev-master [InvalidArgumentException] Package knplabs/knp-menu-bundle at version dev-master has a PHP requirement…
1
vote
2 answers

KNP menu Symfony 3.4

I'm having a hard time getting this to work, I get the following error: Unable to find template "KnpMenuBundle::menu.html.twig" (looked into: D:\Server\htdocs\symfonudem\app/Resources/views,…
Ndong Akwo
  • 592
  • 5
  • 13
1
vote
1 answer

Argument 1 passed to Builder::__construct() must implement interface Knp\Menu\FactoryInterface, none given

Using Symfony 3.3.12, i'm trying to use my menu builder as a service, this is configured in AppBundle/Resources/config/services.yml and imported in main config.yml as imports: - { resource: "@AppBundle/Resources/config/services.yml"…
Jack Skeletron
  • 1,351
  • 13
  • 37
1
vote
1 answer

knpMenu can't add dynamique route

I'm working with symfony 3.3 and knpMenu 2.2 I have register a menu builder as service lilworks_store.menu_builder: class: LilWorks\StoreBundle\Menu\MenuBuilder arguments: ["@knp_menu.factory","@request_stack"] tags: - {…
1
vote
1 answer

knp menu bundle - how to add tags to a tag?

How to add tags to (a) tag ? I can add to a ->setLinkAttribute('class', 'fa fa-edit') but this does not solve my problem. If I add ->setLabel('Forms') It show my tags element as well. I would like to achieve like…
Daniel
  • 197
  • 1
  • 3
  • 16
1
vote
0 answers

Instructions for migrate legacy Knp-Menu code to version 2.0

I need to migrate a really old version of Knp Menu to a newest one. The real problem is here $collapse = new CollapseItem($group,$router->generate('seguridad_group_list'),array('class'=>'submenu'),'Primicia\SeguridadBundle\Menu\CollapseItem'); …
denny
  • 23
  • 5
1
vote
2 answers

Symfony 3 - KNP paginator error - Route issue?

I added a pagination using KNP Paginator. It works well except for one page that render a page for specific ID. This page worked well before I added the pagination. the function was public function orderDetailAction($id) For the pagination, I added…
Eskinder
  • 93
  • 3
  • 11
1
vote
0 answers

Wrong route matched with same sub name

here is my menu class. public function createShopAdminMenu() { $menu = $this->factory ->createItem('root') ->setChildrenAttribute('class', 'nav nav-pills') ; $menu->addChild('Administration', ['route' =>…
Patrick
  • 829
  • 2
  • 13
  • 34
1
vote
1 answer

Override KnpMenu submenu items

I have made a menu with KnpMenu and I'm trying to override the submenu This is how I add submenu items $menu ->addChild('sidebar.front.servers', ['route' => 'server_index']) ->setExtras([ 'icon' => 'fa fa-hdd-o', …
Jérôme
  • 1,966
  • 4
  • 24
  • 48
1 2 3
8 9