pass variable to menu widget

hi. im trying to populate yii2 menu widget items by using a foreach . but it seems its not possible . and it shows either the variables as string or occour an error.

so in below code how can i define ‘label’ value and ‘<span></span>’ and ‘url’ value by helping a foreach loop

OK. it’s so easy …

just use a parameter and pass it to ‘item’

in widget :