Answer the question
In order to leave comments, you need to log in
Problem with Menu widget in Yii2?
How can I implement a menu with fa icons using yii\widgets\Menu type
It doesn't work<li><a><i class="fa fa-home"></i> Home </a></li>
<?php
echo Menu::widget([
'items' => [
['label' => 'Home', 'url' => ['default/index'], 'icon' => 'fa-home'],
['label' => 'Categories', 'url' => ['category/index'], 'icon' => 'fa-bars'],
['label' => 'Articles', 'url' => ['article/index'], 'icon' => 'fa-newspaper-o'],
['label' => 'Languages', 'url' => ['language/index'], 'icon' => 'fa-refresh'],
],
]);
?>
Answer the question
In order to leave comments, you need to log in
Maybe something like this
<?php
echo Menu::widget([
'encodeLabels' => false,
'items' => [
['label' => '<i class="fa fa-home"></i> Home', 'url' => ['default/index']],
],
]);
?>
echo Menu::widget([
'items' => [
[
'label' => '<a><i class="fa fa-home"></i> Home </a>',
'url' => ['default/index'],
'encode' => false
],
]
]);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question