How to add tags to (a) tag ?
I can add to a ->setLinkAttribute('class', 'fa fa-edit')
but this does not solve my problem.
If I add ->setLabel('<i class="fa fa-edit"></i>Forms')
It show my tags element as well.
I would like to achieve like below:
<ul>
<li>
<a>
<i class="fa fa-edit"></i> <--here
Forms
<span class="fa fa-chevron-down"></span> <--here
</a>
</li>
</ul>
I found a solustion.
I changed:
{{ knp_menu_render('InfAccountBundle:Builder:Menu') }}
to:
{{ knp_menu_render('InfAccountBundle:Builder:Menu', {'allow_safe_labels': true}) | raw }}
and added extra to label:
$menu->addChild('Baza', array('uri' => '#','childrenAttributes' => array(
'class' => 'nav child_menu',
)))->setLabel('<i class="fa fa-edit"></i>Baza<span class="fa fa-chevron-down"></span>')->setExtra('safe_label',true);