knpmenu

How to avoid “knp_menu.factory” deprecation?

狂风中的少年 提交于 2020-01-07 04:41:08
问题 I'm trying to use KNPMenuBundle with Sumfony 3.3 but I'm getting this annoying warning: Autowiring services based on the types they implement is deprecated since Symfony 3.3 and won't be supported in version 4.0. You should rename (or alias) the "knp_menu.factory" service to "Knp\Menu\FactoryInterface" instead. Trace: {..../vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php:344: } I did not set this knp_menu.factory at all, probably it was automatically

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

人走茶凉 提交于 2019-12-24 06:04:57
问题 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 .) [link 1], [link 2], [link 3] in order to manage Menus. Bootstrap v3.3.7 Bootstrap and KnpMenuBundle integration [link 4] Setting up To setup i used documentation in [2], [3] and code samples [4]. My menu is working, integration between Bootstrap and

Render custom attribute KNP Menu

风流意气都作罢 提交于 2019-12-12 13:19:20
问题 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 pe_planner'), 'extra' => array( 'content' => 'my custom content' ) )); I have overriden the linkElement by adding an extra div after the a-tag. In that div I would like to render extra content {% block linkElement %} {% import _self as knp_menu %} <a href="{{ item.uri

Symfony 2 breadcrumbs with KnpMenu

蓝咒 提交于 2019-12-11 07:24:39
问题 I use stable versions of KnpMenu and KnpMenuBundle - v.1.2.0 I can't use v.2, because of some dependencies. And I'm trying to build breadcrumbs, depending on my menu. Let's start with menu. I have my MenuBuilder class: $menu = $this->factory->createItem('main'); $menu->setLabel('Main'); $menu->addChild('home', array('route' => 'home','label'=>'Home')); $menu['home']->addChild('level1',array('route' => 'level1', 'label' => 'Level1')); $menu['home']['level1']->addChild('level2',array('route' =>

How to disable HTML escaping of labels in KnpMenuBundle

℡╲_俬逩灬. 提交于 2019-12-05 15:02:32
问题 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? 回答1: Ok, the answer is! You set up extra items on menu item

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