This is more than likely going to be straight forward, or convoluted, but here goes...

How do you add a data attribute to a form element?

有帮助吗?

解决方案

Simply:

$element->setAttribute('data', 'somedata');

其他提示

Kicking myself right now!

Just remembered I'd already done it previously.

...
'attributes' => array(
    ...
    'data-xxx' => '',
    ...
),

>.<

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top