php - How can i add title attributes in links using the Yii2 framework?Get the solution ↓↓↓
I created a navigation menu in yii2 and i have links generated by the following code:
<?= 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??
OK, finally i managed to make it work with the help of Michal HynДЌica.
I had to use
'options' => ['title' => 'HELLO WORLD'],
so the code should be:
'items' => [ [ 'options' => ['title' => 'HELLO WORLD'], 'label' => Yii::t('lang', 'Browse'), 'url' => ['directory/index'], 'icon' => 'home', 'title' => 'HELLO WORLD' ],
Share solution ↓
Link To Answer People are also looking for solutions of the problem: malformed utf-8 characters, possibly incorrectly encoded
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.