如何使用 Yii2 框架在链接中添加标题属性?

How can i add title attributes in links using the Yii2 framework?

我在 yii2 中创建了一个导航菜单,我有通过以下代码生成的链接:

  <?= 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'
                    ],
                    
                ],
            ]) ?>

但是 title 属性不起作用。我做错了什么??

好的,在 Michal Hynčica 的帮助下我终于成功了。

我必须使用 options 密钥:

'options' => ['title' => 'HELLO WORLD'],

所以代码应该是:

'items' => [
                    [
                        'options' => ['title' => 'HELLO WORLD'],
                        'label' => Yii::t('lang', 'Browse'),
                        'url' => ['directory/index'],
                        'icon' => 'home',
                        'title' => 'HELLO WORLD'
                    ],