Answer the question
In order to leave comments, you need to log in
Why is there an error in the nav widget?
I tried to automatically add items to the menu when adding entries to the firmcat table in the nav widget like this
if(isset($firm)){
function menuitemFirm($firm){
$arr=array();
foreach($firm as $cat){
array_push($arr,[
'label'=>Html::tag('span',Html::img(iconFirm($cat->id)),['class'=>'col-md-8 noMobile']).''. Html::tag('span',$cat->title,['class'=>'col-md-16 col-sm-12 col-xs-24']),
'url'=>['/firmcat/list?id='.$cat->id],
'linkOptions'=>[
'class' => $cat->id.' col-md-24 col-xs-24'
],
'encode' => false
]);
}
return $arr;
}
$menuItems[]=[
'label' => 'По производителям',
'url' =>'#',
'items' => [ menuitemFirm($firm)],
'dropDownOptions'=>[
'class'=>'dropdown-menu col-md-24 col-xs-24'
],
];
}
array(2) {
[0]=> array(4) {
["label"]=> string(212) "Алуштинский эфиромасличный совхоз-завод"
["url"]=> array(1) { [0]=> string(18) "/firmcat/list?id=1" }
["linkOptions"]=> array(1) {
["class"]=> string(21) "1 col-md-24 col-xs-24" }
["encode"]=> bool(false) }
[1]=> array(4) {
["label"]=> string(166) "Крымская стевия"
["url"]=> array(1) {
[0]=> string(18) "/firmcat/list?id=2" }
["linkOptions"]=> array(1) {
["class"]=> string(21) "2 col-md-24 col-xs-24"
}
["encode"]=> bool(false) } }
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question