Yii2可编辑的小部件自定义属性


Yii2 Editable Widget custom attribute

我正在使用Yii2和Editable Widget

我的代码在 下面
Editable::widget([
                    'id' => 1,
                    'name' => 'assignTo',
                    'value' => 1,
                    'url' => 'url here',
                    'type' => 'select',
                    'mode' => 'inline',
                    'clientOptions' => [
                        'toggle' => 'dblclick',
                        'emptytext' => 'Unassigned',
                        'placement' => 'right',
                        'select2' => [
                            'width' => '124px'
                        ],
                        'source' => 1,
                        'value' => 1,
                    ],
                ]);

我想在生成的html标签上添加custom attribute。我已经尝试如下,但它抛出错误

Editable::widget([
                    'id' => 'assignTo_'.$todo->id,
                    'name' => 'assignTo',
                    'redirect_url' => 'custom_attriute', // this is custom attribute that i need
                    'class' => 'my own custom class', // this is custom attribute that i need
                    'value' => 1,
                    'url' => 'url here',
                    'type' => 'select',
                    'mode' => 'inline',
                    'clientOptions' => [
                        'toggle' => 'dblclick',
                        'emptytext' => 'Unassigned',
                        'placement' => 'right',
                        'select2' => [
                            'width' => '124px'
                        ],
                        'source' => 1,
                        'value' => 1,
                    ],
                ]);

,我也想在生成的HTML中添加我自己的类,我已经尝试了上面的相同,但它不起作用。

有没有办法使我想要的成为可能?

dosamigos'editable'Editable扩展了yii'widgets'InputWidget, $options变量包含:

输入标签的HTML属性

Editable::widget([
    'id' => 'assignTo_'.$todo->id,
    'name' => 'assignTo',
    'options' => [
        'redirect_url' => 'custom_attriute', // this is custom attribute that i need
        'class' => 'my own custom class', // this is custom attribute that i need
    ],
    'value' => 1,
    'url' => 'url here',
    'type' => 'select',
    'mode' => 'inline',
    'clientOptions' => [
        'toggle' => 'dblclick',
        'emptytext' => 'Unassigned',
        'placement' => 'right',
        'select2' => [
            'width' => '124px'
        ],
        'source' => 1,
        'value' => 1,
    ],
]);