SubmenuTemplate

I need a two-level menu in my view with a custom class for inner ul tag. So, I’m using MenuWidget for it:




<?= widgets\Menu::widget([

    'items' => [

        [ 'label' => 'First', 'url' => ['site/first'], 'items' => [

            [ 'label' => 'test', 'url' => ['site/test'] ]

        ], 'submenuTemplate' => "\n<ul class=\"custom\">{items}</ul>"],

        [ 'label' => 'Second', 'url' => ['site/second'] ],

    ]) ?>



But it seems submenuTemplate is not working right. At least I can’t see any effect of it, it’s just <ul>{items}</ul> in reasult.

May be I’m doing it wrong, or there’s another way to do it?

Yeah, I did it wrong.

If anyone will have this kind of problem, here’s how it should be:




<?= widgets\Menu::widget([

    'items' => [

        [ 'label' => 'First', 'url' => ['site/first'], 'items' => [

            [ 'label' => 'test', 'url' => ['site/test'] ]

        ]], 

        [ 'label' => 'Second', 'url' => ['site/second'] ],

    ], 'submenuTemplate' => "\n<ul class=\"custom\">{items}</ul>"] ) ?>