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
5
votes
1 answer

Admin Page Column Sorting

We're using the Sonata bundle for our admin section. When a user goes to any section in admin, products for instance, and tries to sort by a particular column, it doesn't remember the sort order in the next page and also, the user can only sort in…
Kunwar Siddharth Singh
  • 1,676
  • 6
  • 33
  • 66
4
votes
1 answer

Filtering of menu items based on a user role

I have multiple user roles on my site. Some of the controllers have access restriction based on a user role. I also have a menu (based on KnpMenuBundle), and I need include only items which are accessible for a logged-in user. For now I've decided…
Vasily
  • 1,858
  • 1
  • 21
  • 34
4
votes
2 answers

How to create a breadcrumb with KNP Menu Bundle 2?

So I have a menu built as shown in the example below:
breq
  • 24,412
  • 26
  • 65
  • 106
4
votes
1 answer

Symfony2, Do not use alias in url with KnpPaginatorBundle

I'm using KnpPaginatorBundle and I would like to know if it is possible to get an url without alias (t.country) like this /travels?sort=country&direction=asc not like this /travels?sort=t.country&direction=asc This the form :
hous
  • 2,577
  • 2
  • 27
  • 66
4
votes
1 answer

Passing Parameters to KnpMenuBundle-MenuBuilder (registered as service)

I want to pass an additional parameter {'id': '555'} from a twig-template to the $options-parameter in the MenuBuilder.php. The twig looks like: ... {{ knp_menu_render('createSwitchButton', {'id': '555'} ) }} ... The service.yml looks like: …
user3844495
  • 95
  • 1
  • 4
4
votes
3 answers

Creating breadcrumbs in symfony 2.1 using knpmenu bundle

What's the best way to create breadcrumbs using knpmenu bundle in symfony 2.1.x ? Aside from using 3-rd party bundles. UPDATE: Hi, theunraveler, sorry for late answer. Now I've been following your example and I'm stuck at one moment. Here, code…
Mister Been
  • 125
  • 1
  • 9
3
votes
1 answer

Argument is nullable and no null value has been provided

I'm using KnpMenuBundle to generate childs of my menu. For each category, I have subcategory. I passed the 2 parameters in my method (in the controller as mentioned below). The principle menu of categories works well but when I click on one of the…
Amira Bedhiafi
  • 8,088
  • 6
  • 24
  • 60
3
votes
1 answer

Sonata Admin Class : add KnpMenu links pointing Admin class with custom route

Using SonataAdminBundle with Symfony2, I'm looking for a solution to access some Admin classes with a specific route. For example, I have a ContractAdmin class with boolean fields such as "Enabled". What I would like is to add in the left KnpMenu of…
3
votes
0 answers

KNPMenu + Matcher + Voter

Evening to all, I'm developing a breadcrumbs system by a KNP Menu ready coded. I'm getting a problem when trying to get breadcrumbs with theis own URI and name for a tree. E.g: For /menuItem1/category1/ I am looking for Menuitem --> Category1 To…
Makros
  • 31
  • 2
3
votes
0 answers

Set current only one item with RegexVoter from KnpMenu

I use the regexVoter from knpMenu like this //This is on my createMenuAction $this->matchingRoute($menu); /** * @param $menu * * @return bool */ private function matchingRoute($menu) { foreach ($menu->getChildren() as $child) { …
Jérôme
  • 1,966
  • 4
  • 24
  • 48
3
votes
2 answers

knp menu bundle symfony

I have been using a fos user Bundle where each of user is assigned to a group and each group is provided with a specific role as per fos user bundle everything works fine. Now to make a menu system I am trying to use Knp menu bundle.Now to make menu…
Sagar Chapagain
  • 375
  • 4
  • 13
3
votes
0 answers

KnpMenuBundle - current class on all subpages

I create a menu by KnpMenuBundle class Builder extends ContainerAware { public function adminMenu(FactoryInterface $factory, array $options) { $menu = $factory->createItem('root'); $menu->addChild('Object', array( …
klapaucius
  • 111
  • 3
  • 11
3
votes
1 answer

Render custom attribute KNP Menu

Is there a way to render a custom attribute in the KNP Menu Bundle, something like this: $menu = $factory->createItem(Role::ROLE_PROGRAM_EVENT_PLANNER, array( 'route' => 'show_form_events', 'attributes' => array('class' => 'menu…
xfscrypt
  • 16
  • 5
  • 28
  • 59
3
votes
2 answers

Symfony2 KnpMenuBundle children with dynamic parameters

Let's say I have a routing setup like that : users_list: pattern: /users defaults: { _controller: AcmeBundle:User:list } user_edit: pattern: /user-edit/{id} defaults: { _controller: AcmeBundle:User:edit } I would like to setup a…
Thomas Piard
  • 1,209
  • 2
  • 15
  • 25
3
votes
2 answers

Symfony 2 Nav. Menu, open in new window

I'm attempting to create a new window when a user clicks a link in the navigation menu. What I'm attempting to do at present is just add a target="_blank" item to the url, thereby creating an entirely new page, and from there I'm planning to learn…
Gyhth
  • 1,155
  • 9
  • 21
1
2
3
8 9