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 5.0 and KnpMenuBundle - how to configure

In a Symfony 5.0 Application I want to use the KnpMenuBundle. I installed it by running composer require knplabs/knp-menu-bundle "^3.0" This automatically created an entry in…
user3440145
  • 793
  • 10
  • 34
2
votes
0 answers

Twig not looking in project's app/Resources/views folder for template

I am working on an upgrade from Symfony 2.7 to Symfony 3.4. When trying to load twig template from controller, it is not searching in project's app/Resources/views/ folder. This is my controller's code: return $this->render('::layout.html.twig', [ …
2
votes
1 answer

How to exclude certain string from showing up in missing translations using KnpMenuBundle and Symfony3

Introduction In my personal project I am using: XAMPP with PHP v7.1.6 Symfony v3.3.8 KnpMnenuBundle dev-master / 2.2.x-dev (dev version because it is compatible with current Symfony 3.3.x version, earlier versions did not install via composer.)…
Rikijs
  • 728
  • 1
  • 12
  • 48
2
votes
0 answers

Can you make KNPMenu Voters Private?

I'm trying generate breadcrumbs as per the recent (2.2) update but am having a problem getting the correct current item via: knp_menu_get_current_item() After a bunch of digging I found a conflict with a Voter that's been included from…
benrcole
  • 143
  • 2
  • 6
2
votes
1 answer

KNP menu - highlight parent menu

With Symfony 3.1 and KNP menu bundle I build a 2 level menu tree. The selected page gets highlighted within the menu. As I am using a drop-down menu, I additionaly want the top level of menu being highlighted - basically the parent entry of my…
Wolfram
  • 99
  • 2
  • 7
2
votes
1 answer

add admin groups and item to sonata admin in symfony

I followed the tutorial of sonata admin and it does generate the menu but everything is under a "default" group. I would like to add new groups like "users", "events" and so on. I try to do that found on…
Christophe Ferreboeuf
  • 1,048
  • 14
  • 26
2
votes
1 answer

How to register custom voter in Symfony KNP Menu Bundle?

so I decided to use the KnpMenuBundle in my Symfony project, but in order for the menu to work as I intend to, I added 2 lines to the /vendor/knplabs/knp-menu/src/Knp/Menu/Matcher/Voter/RouteVoter.php. So I know it's a bad practice to change the…
Mike
  • 6,854
  • 17
  • 53
  • 68
2
votes
1 answer

Symfony2 KnpPaginator bundle Get Data from multiple entities and render in one Grid/Pagination

I have a scenario where a role called MIS_Data_Entry. The Job of role is to input data in muliple entites. but it's key field `verified is set to false'. The MIS_Manager recieves these data and either accept it or reject. Now for MIS_Data_Entry. I…
Muhammad Taqi
  • 5,356
  • 7
  • 36
  • 61
2
votes
2 answers

Attempted to call an undefined method named "setCurrentUri" of class "Knp\Menu\MenuItem"

i'm trying to configure sonataUserBundle and fosUserBundle. when i try to access to my profile page , i got this error : Attempted to call an undefined method named "setCurrentUri" of class "Knp\Menu\MenuItem". Did you mean to call…
Dario
  • 103
  • 1
  • 2
  • 9
2
votes
0 answers

KnpMenu: add attribute to MenuItem class

I am using KnpMenu with Symfony2.3 through the KnpMenuBundle. I would like to customize the class MenuItem by adding an attribute, the simplest way. The aim is to be able to link any MenuItem to one of my application's entity, and to retrieve it…
Blacksad
  • 1,230
  • 1
  • 14
  • 23
2
votes
1 answer

Remove RouteVoter on a KnpMenu

Each bundle of the extranet is a independent application. In my menu every app is listed and I like to mark the current one depending the actual route prefix. First the twig code in the base.html.twig: {{…
binzram
  • 530
  • 4
  • 13
2
votes
1 answer

KnpMenuBundle, keep Main Menu active even for sub actions

my question is related to the following, is this the "proper" way or is there a better solution ? Symfony2 KnpMenuBundle: set active a menu item even when its not on that menu Thats my current code: public function mainMenu(FactoryInterface…
DasLicht
  • 33
  • 5
2
votes
0 answers

KnpMenu - Is it possible to use only one menu tree for my web application?

I am using KnpMenuBundle in a Symfony2 project. I wonder if it is possible and good to only use one tree menu in my App. It would have 3-4 levels. I don't wan't to have sub-menus but I wan't to use the same menu to create my breadcrumb. Also, is it…
Frank6
  • 1,193
  • 1
  • 11
  • 23
2
votes
1 answer

KnpMenuBundle menu items from multiple bundles

Is it possible to obtain menu items from multiple bundles with the KnpMenuBundle? As for now I've been working with the service but that's overwritten if you declare it in multiple bundles. I read something about the custom providers…
Peep
  • 83
  • 7
2
votes
2 answers

KnpMenuBundle - send Options and use them in Twig

I wrote the last days on my nav-bar-menu whit KnpMenuBundle. I want simply to give the template a few parameters on the way and then react on it. Is it possible? I tried this: $menu->addChild('Registration', array('route' =>…
Slowwie
  • 1,146
  • 2
  • 20
  • 36
1 2
3
8 9