I created a navigation menu in yii2 and i have links generated by the following code:
JavaScript
x
<?= HeaderNavigation::widget([
'options' => ['class' => 'nav nav-tabs border-0 flex-column flex-lg-row'],
'itemOptions' => [
'class' => 'nav-item',
],
'items' => [
[
'label' => Yii::t('lang', 'Browse'),
'url' => ['directory/index'],
'icon' => 'home',
'title' => 'HELLO WORLD'
],
],
]) ?>
but title attribute doesn’t work. What i m doing wrong??
Advertisement
Answer
OK, finally i managed to make it work with the help of Michal Hynčica.
I had to use options
key:
JavaScript
'options' => ['title' => 'HELLO WORLD'],
so the code should be:
JavaScript
'items' => [
[
'options' => ['title' => 'HELLO WORLD'],
'label' => Yii::t('lang', 'Browse'),
'url' => ['directory/index'],
'icon' => 'home',
'title' => 'HELLO WORLD'
],