Options for Html::tag with not only class/id

Here is the tag:

[html]<ul id="dn4" class="accordion" data-accordion data-allow-all-closed="true">[/html]

What is the best/elegant/smart way to set options array for Html::tag?

Especially for attribute with no value like "data-accordion"?

Hi pwwl, welcome to the forum.

Please look at the following page in API reference.

renderTagAttributes()

http://www.yiiframework.com/doc-2.0/yii-helpers-basehtml.html#renderTagAttributes()-detail

Try the following:




'data' => ['accordion', 'allow-all-closed' => true]



(Sorry, not tested)