15
15
use yii \db \ActiveRecord ;
16
16
use yii \helpers \Html ;
17
17
use yii \helpers \ArrayHelper ;
18
+ use yii \bootstrap \Button ;
18
19
use unclead \widgets \assets \MultipleInputAsset ;
19
20
20
21
21
22
/**
22
- * Widget for rendering multiple input for one attribute of model.
23
+ * Widget for rendering multiple input for an attribute of model.
23
24
*
24
25
* @author Eugene Tupikov <unclead.nsk@gmail.com>
25
26
*/
@@ -204,8 +205,8 @@ private function getRowTemplate()
204
205
$ this ->template .= Button::widget (
205
206
[
206
207
'tagName ' => 'div ' ,
207
- 'label ' => false ,
208
- 'iconClass ' => ' glyphicon glyphicon-{btn_action} ' ,
208
+ 'encodeLabel ' => false ,
209
+ 'label ' => Html:: tag ( ' i ' , null , ' glyphicon glyphicon-{btn_action} ') ,
209
210
'type ' => '{btn_type} ' ,
210
211
'options ' => [
211
212
'id ' => $ this ->getElementId ('button ' ),
@@ -229,7 +230,7 @@ private function getRowTemplate()
229
230
private function renderRow ($ index , $ data = null )
230
231
{
231
232
$ btnAction = $ index == 0 ? self ::ACTION_ADD : self ::ACTION_REMOVE ;
232
- $ btnType = $ index == 0 ? Button:: TYPE_DEFAULT : Button:: TYPE_DANGER ;
233
+ $ btnType = $ index == 0 ? ' btn-default ' : ' btn-danger ' ;
233
234
234
235
$ search = ['{index} ' , '{btn_action} ' , '{btn_type} ' ];
235
236
$ replace = [$ index , $ btnAction , $ btnType ];
@@ -334,7 +335,7 @@ public function registerClientScript()
334
335
'id ' => $ this ->getId (),
335
336
'template ' => $ this ->getRowTemplate (),
336
337
'btn_action ' => self ::ACTION_REMOVE ,
337
- 'btn_type ' => Button:: TYPE_DANGER ,
338
+ 'btn_type ' => ' btn-danger ' ,
338
339
'limit ' => $ this ->limit ,
339
340
'replacement ' => $ this ->replacementKeys ,
340
341
]
0 commit comments