Customize the KnpMenuBundle

后端 未结 5 1991
无人共我
无人共我 2020-12-13 01:55

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:

5条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-13 02:33

    I spent a while figuring this out.

    There is an parameter you can apply when defining the menu item called 'safe_label'. By setting this to true it output the image in the navbar instead of the html.

        $image = "";
        $menu->addChild( $image , 
          array(
            'route' => 'url_route_name',
            'extras' => array(
              'safe_label' => true
            )
          )
        );
    

    Hope that helps

提交回复
热议问题