File tree Expand file tree Collapse file tree 5 files changed +44
-3
lines changed Expand file tree Collapse file tree 5 files changed +44
-3
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ Yii2 multiple input change log
3
3
4
4
2.10.0
5
5
======
6
-
6
+ - # 170 : Added global options ` enableError `
7
7
- #154 : Added missing js event: beforeAddRow
8
8
9
9
2.9.0
Original file line number Diff line number Diff line change @@ -129,6 +129,12 @@ class MultipleInput extends InputWidget
129
129
*/
130
130
public $ sortable = false ;
131
131
132
+ /**
133
+ * @var bool whether to render inline error for all input. Default to `false`. Can be override in `columns`
134
+ * @since 2.10
135
+ */
136
+ public $ enableError = false ;
137
+
132
138
/**
133
139
* Initialization.
134
140
*
@@ -238,7 +244,8 @@ private function createRenderer()
238
244
'rowOptions ' => $ this ->rowOptions ,
239
245
'context ' => $ this ,
240
246
'form ' => $ this ->form ,
241
- 'sortable ' => $ this ->sortable
247
+ 'sortable ' => $ this ->sortable ,
248
+ 'enableError ' => $ this ->enableError ,
242
249
];
243
250
244
251
if ($ this ->removeButtonOptions !== null ) {
Original file line number Diff line number Diff line change @@ -115,6 +115,12 @@ class TabularInput extends Widget
115
115
*/
116
116
public $ sortable = false ;
117
117
118
+ /**
119
+ * @var bool whether to render inline error for all input. Default to `false`. Can be override in `columns`
120
+ * @since 2.10
121
+ */
122
+ public $ enableError = false ;
123
+
118
124
/**
119
125
* Initialization.
120
126
*
@@ -165,7 +171,8 @@ private function createRenderer()
165
171
'addButtonPosition ' => $ this ->addButtonPosition ,
166
172
'context ' => $ this ,
167
173
'form ' => $ this ->form ,
168
- 'sortable ' => $ this ->sortable
174
+ 'sortable ' => $ this ->sortable ,
175
+ 'enableError ' => $ this ->enableError ,
169
176
];
170
177
171
178
if ($ this ->removeButtonOptions !== null ) {
Original file line number Diff line number Diff line change @@ -126,6 +126,12 @@ abstract class BaseRenderer extends Object implements RendererInterface
126
126
*/
127
127
public $ sortable = false ;
128
128
129
+ /**
130
+ * @var bool whether to render inline error for all input. Default to `false`. Can be override in `columns`
131
+ * @since 2.10
132
+ */
133
+ public $ enableError = false ;
134
+
129
135
/**
130
136
* @inheritdoc
131
137
*/
@@ -243,6 +249,10 @@ protected function initColumns()
243
249
$ definition ['attributeOptions ' ] = $ this ->attributeOptions ;
244
250
}
245
251
252
+ if (!array_key_exists ('enableError ' , $ definition )) {
253
+ $ definition ['enableError ' ] = $ this ->enableError ;
254
+ }
255
+
246
256
$ this ->columns [$ i ] = Yii::createObject ($ definition );
247
257
}
248
258
}
Original file line number Diff line number Diff line change @@ -28,6 +28,23 @@ public function testGuessColumn()
28
28
$ this ->assertEquals ($ expected , $ widget ->columns );
29
29
}
30
30
31
+ public function testGlobalErrorGuessColumn ()
32
+ {
33
+ $ model = new TestModel ();
34
+
35
+ $ widget = new MultipleInput ([
36
+ 'model ' => $ model ,
37
+ 'attribute ' => 'email ' ,
38
+ 'enableError ' => true ,
39
+ ]);
40
+
41
+ $ expected = [
42
+ ['name ' => 'email ' , 'type ' => MultipleInputColumn::TYPE_TEXT_INPUT , 'enableError ' => true ]
43
+ ];
44
+
45
+ $ this ->assertEquals ($ expected , $ widget ->columns );
46
+ }
47
+
31
48
public function testInitData ()
32
49
{
33
50
$ model = new TestModel ();
You can’t perform that action at this time.
0 commit comments