Php Yii2可编辑小部件自定义属性
我正在使用Yii2并使用Php Yii2可编辑小部件自定义属性,php,yii2,widget,Php,Yii2,Widget,我正在使用Yii2并使用可编辑小部件 我的代码在下面 Editable::widget([ 'id' => 1, 'name' => 'assignTo', 'value' => 1, 'url' => 'url here', 'type' => 'select',
可编辑小部件
我的代码在下面
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标记上添加自定义属性
。我试过如下,但它的抛出错误
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
,该变量包含:
输入标记的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,
],
]);