Customize the KnpMenuBundle

后端 未结 5 1988
无人共我
无人共我 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条回答
  •  臣服心动
    2020-12-13 02:30

    To simply add classes and other HTML attributes (for example, to integrate the menù with Twitter Bootstrap addind its classes and IDs), you can use the methods provided for that sort of customization.

    Here are some useful resources:

    • Here are all the details from KNP Menu Bundle's documentation: Creating Menus: The Basics - Menu attributes
    • Here are some concrete examples: (On GitHub) KNP Menu Bundle with Bootstrap 3 and Font Awesome 4

    KnpMenuBundles provides some documented methods like setAttributes, selLinkAttirbute or setLabelAttribute (and other methods too) that are useful to customize the menù rendering.

提交回复
热议问题