Reputation: 6649
I have a menu i have created in yii2 and i would like to remove the href value to #
This is what i have done
<?php
echo Menu::widget([
'encodeLabels' => false,
'options' => [
'class' => 'topnav menu-left-nest'
],
'items' => [
[
'label' => ThemeNav::link('Manager action, 'fa fa-user'),
'url' => ["#"], //this is the url {{i}}
'options' => ['class' => 'tooltip-tip'],
'items' => [
...items in the dropdown
],
When i check on the inspect element The above url ({{i}}) generates a value eg
<a href="/webwisekenya/advanced/backend/site/#"></a>
But i would like it to remain as
<a href="#"></a>
How do i go about this
This is the themenav class function link
public static function link($label, $icon = null) {
$link = null;
if (!empty($icon))
$link .= Html::tag('i','',['class'=>$icon]);
$link .= Html::tag('span', $label, []);
return $link;
}
Upvotes: 0
Views: 1294
Reputation: 21
['label' => ThemeNav::link('Manager action, 'fa fa-user'),, 'url' => '#'],
Upvotes: 0
Reputation: 66
In Item list spécification, url can be defined as array or string:
url var is used with the function Url::to. More info here: http://www.yiiframework.com/doc-2.0/yii-helpers-baseurl.html#to()-detail
Manual about widget menu items: http://www.yiiframework.com/doc-2.0/yii-widgets-menu.html#$items-detail
Upvotes: 1