File tree Expand file tree Collapse file tree 3 files changed +15
-8
lines changed Expand file tree Collapse file tree 3 files changed +15
-8
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,8 @@ Yii2 multiple input change log
4
4
2.18.0 (in development)
5
5
=======================
6
6
- #246 accept ` \Traversable ` in model attribute for ` yield ` compatibility (bscheshirwork)
7
- - #250 accept ` \Traversable ` in TableRenderer and ListRenderer for ` yield ` compatibility (bscheshirwork)
7
+ - #250 accept ` \Traversable ` in TableRenderer and ListRenderer for ` yield ` compatibility (bscheshirwork)
8
+ - #253 allow to omit a name for static column
8
9
9
10
2.17.0
10
11
======
Original file line number Diff line number Diff line change 124
124
]
125
125
],
126
126
[
127
- 'name ' => 'comment ' ,
127
+ 'name ' => 'comment ' , // can be ommited in case of static column
128
128
'type ' => MultipleInputColumn::TYPE_STATIC ,
129
129
'value ' => function ($ data ) {
130
130
return Html::tag ('span ' , 'static content ' , ['class ' => 'label label-info ' ]);
180
180
});
181
181
JS ;
182
182
183
- $ this ->registerJs ($ js );
183
+ $ this ->registerJs ($ js );
Original file line number Diff line number Diff line change @@ -38,6 +38,8 @@ abstract class BaseColumn extends BaseObject
38
38
39
39
const TABINDEX = 1 ;
40
40
41
+ const DEFAULT_STATIC_COLUMN_NAME = 'static-column ' ;
42
+
41
43
/**
42
44
* @var string input name
43
45
*/
@@ -128,7 +130,7 @@ abstract class BaseColumn extends BaseObject
128
130
* @since 2.8
129
131
*/
130
132
public $ nameSuffix ;
131
-
133
+
132
134
/**
133
135
* @var Model|ActiveRecordInterface|array
134
136
*/
@@ -165,14 +167,18 @@ public function init()
165
167
{
166
168
parent ::init ();
167
169
168
- if (empty ($ this ->name )) {
169
- throw new InvalidConfigException ("The 'name' option is required. " );
170
- }
171
-
172
170
if ($ this ->type === null ) {
173
171
$ this ->type = self ::TYPE_TEXT_INPUT ;
174
172
}
175
173
174
+ if ($ this ->type === self ::TYPE_STATIC && empty ($ this ->name )) {
175
+ $ this ->name = self ::DEFAULT_STATIC_COLUMN_NAME ;
176
+ }
177
+
178
+ if (empty ($ this ->name )) {
179
+ throw new InvalidConfigException ("The 'name' option is required. " );
180
+ }
181
+
176
182
if (empty ($ this ->options )) {
177
183
$ this ->options = [];
178
184
}
You can’t perform that action at this time.
0 commit comments