knpmenubundle

Creating breadcrumbs in symfony 2.1 using knpmenu bundle

喜你入骨 提交于 2019-12-05 12:47:22
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 below throws an exception, that Missing argument 2 for Acme\DemoBundle\Menu\MenuBuilder::getBreadCrumbs() {% set item = knp_menu_get('main') %} {{ knp_menu_render(item) }} {% block breadcrumbs %} {% set breadcrumbs = knp_menu_get('breadcrumbs', [], {'request': app.request, 'menu': item }) %} {{ dump(breadcrumbs) }} {% endblock %} Why it doesn't accepts

symfony2.1 bundle version confusion, for symfony and sonata admin / knp menu bundle

走远了吗. 提交于 2019-12-05 06:05:49
I want to use symfony2.1 for a new project. I try to install symfony2 with composer. But there were multiple errors/problems and so I have also questions for each problem in bold font style . Sometimes I don't know if I do it the right way. I want to use a stable version so I chosen the 2.1.0 version and not the dev/master. php composer.phar create-project symfony/framework-standard-edition symfony v2.1.0 the result was this: Installing symfony/framework-standard-edition (v2.1.0) - Installing symfony/framework-standard-edition (v2.1.0) Downloading: 100% Created project in symfony Loading

How to disable HTML escaping of labels in KnpMenuBundle

跟風遠走 提交于 2019-12-04 00:35:06
I want to render an HTML label like: $menu->addChild('Dashboard', array( 'route' => 'dashboard', 'label' => '<i class="fa-icon-bar-chart"></i><span class="hidden-tablet"> Dashboard</span></a>', 'extra' => array('safe_label' => true) ) ); And I've pass the proper option while rendering: {{ knp_menu_render('WshCmsHtmlBundle:Builder:mainMenu', {'allow_safe_labels': true} ) }} But my label is still being escaped. What am I doing wrong? Ok, the answer is! You set up extra items on menu item not by 'extra' key but by 'extras' key. So when you setup the item like this: $menu->addChild('Dashboard',

KnpMenuBundle - send Options and use them in Twig

给你一囗甜甜゛ 提交于 2019-12-02 04:17:28
问题 I wrote the last days on my nav-bar-menu whit KnpMenuBundle. But I think of give it up. I want simply to give the Template a few parameters on the way and then react on it. I go crazy. Is it possible. I tried this: $menu->addChild('Registration', array('route' => 'fos_user_registration_register', 'icon' => array('glyphicon' => 'briefcase'))); And then I wanna pick this in Twig-Template: {% if icon['glyphicon'] is defined %} <span class="glyphicon glyphicon-{{icon['glyphicon']}} "></span> {%

KnpMenuBundle - send Options and use them in Twig

隐身守侯 提交于 2019-12-02 00:15:58
I wrote the last days on my nav-bar-menu whit KnpMenuBundle. But I think of give it up. I want simply to give the Template a few parameters on the way and then react on it. I go crazy. Is it possible. I tried this: $menu->addChild('Registration', array('route' => 'fos_user_registration_register', 'icon' => array('glyphicon' => 'briefcase'))); And then I wanna pick this in Twig-Template: {% if icon['glyphicon'] is defined %} <span class="glyphicon glyphicon-{{icon['glyphicon']}} "></span> {% endif %} I tried a lot, but nothing works. It must be so simple. I can´t believe, that this should not

Call to method setCurrentUri fails in Symfony/SonataUserBundle setup

假如想象 提交于 2019-12-01 15:50:24
I am trying to set up Symfony with the SonataUserBundle. User registration and login works fine. When I try to call up the /profile view, however I get the following error: Attempted to call method "setCurrentUri" on class "Knp\Menu\MenuItem" in F:\<my project path>\vendor\sonata-project\user-bundle\Block\ProfileMenuBlockService.php line 91. Did you mean to call: "setCurrent"? The last notice in the "event list" before the error is INFO - [cms::renderBlock] block.id=53, block.type=sonata.user.block.menu Has anyone encountered this error before and can provide information on how to resolve it?

Call to method setCurrentUri fails in Symfony/SonataUserBundle setup

时光怂恿深爱的人放手 提交于 2019-12-01 14:56:03
问题 I am trying to set up Symfony with the SonataUserBundle. User registration and login works fine. When I try to call up the /profile view, however I get the following error: Attempted to call method "setCurrentUri" on class "Knp\Menu\MenuItem" in F:\<my project path>\vendor\sonata-project\user-bundle\Block\ProfileMenuBlockService.php line 91. Did you mean to call: "setCurrent"? The last notice in the "event list" before the error is INFO - [cms::renderBlock] block.id=53, block.type=sonata.user

How to change the “current” class to “active” in KNPMenuBundle

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-30 13:09:52
I was wondering, what is the best way to change the "current" class to be "active" so Bootstrap will work correctly with it? I thought about copying and overriding the knp_menu_html.twig but i think its not the best way... Anyway better doing it? You can pass it like that: {{ knp_menu_render('AcmeDemoBundle:Builder:mainMenu', {'currentClass': 'active'}) }} To apply default options in all your application, you can set the knp_menu.renderer.twig.options parameter like this: // app/config/services.yml parameters: knp_menu.renderer.twig.options: currentClass: active Default options of the Knp\Menu

Customize the KnpMenuBundle

谁都会走 提交于 2019-11-28 16:58:57
How to customize KNPMenuBundle? I can't figure out how to add an image or a span tag using the KnpMenuBundle. I simply want this: <ul> <li> <img src="{{asset('bundles/mybundle/images/my_image.png')}} /"> <span>My Title</span> </li> </ul> In the MenuBuilder, this would start with: $menu->addChild('My Title'); How could I add the image in the <li> statement? EDIT: THE EASY WAY There is actually an easy way to do this within the bundle: 1 Copy the template vendor\KnpMenu\src\Knp\Menu\Resources\views\knp_menu.html.twig into your Acme\AcmeBundle\Resources\views\Menu\knp_menu.html.twig and extend it

Customize the KnpMenuBundle

自古美人都是妖i 提交于 2019-11-27 10:07:33
问题 How to customize KNPMenuBundle? I can't figure out how to add an image or a span tag using the KnpMenuBundle. I simply want this: <ul> <li> <img src="{{asset('bundles/mybundle/images/my_image.png')}} /"> <span>My Title</span> </li> </ul> In the MenuBuilder, this would start with: $menu->addChild('My Title'); How could I add the image in the <li> statement? EDIT: THE EASY WAY There is actually an easy way to do this within the bundle: 1 Copy the template vendor\KnpMenu\src\Knp\Menu\Resources