Answer the question
In order to leave comments, you need to log in
How to add id to menu links?
Guys, hello everyone I
register the menu on the site
<div class="c-header__bottom">
<?php
$items = Menu::getTopMenuItems();
if(count($items)):
?>
<nav class="c-navbar c-navbar--fixed@md">
<?php
foreach($items as $i => $item) {
$item['linkOptions'] = array('class' => 'c-navbar__link');
if(isset($item['items']) and count($item['items'])) {
$item['url'] = '#';
$item['link'] = '#';
}
$items[$i] = $item;
}
$this->widget(
'Menu',
array(
'items' => $items,
'id' => 'menu-list',
'htmlOptions' => array('class' => 'o-list-bare c-navbar__menu'),
'itemCssClass' => '',
)
);
?>
<div class="c-topbar__search">
<form class="c-search" action="/shop/search" method="get">
<input class="c-search__input" type="text" name="search" placeholder="Поиск по сайту">
<button class="c-search__submit" type="submit"><span class="u-hidden-visually">Найти</span>
<svg class="c-search__icon">
<use xlink:href="#icon-search"></use>
</svg>
</button>
</form>
</div>
</nav>
<? endif; ?>
</div>
Answer the question
In order to leave comments, you need to log in
It is not clear what you have inside, unreadable code.
In general, the link is formed with an anchor if you add
['view','param1'=>'value','#'=>'jakorb']
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question