File tree Expand file tree Collapse file tree 2 files changed +15
-7
lines changed Expand file tree Collapse file tree 2 files changed +15
-7
lines changed Original file line number Diff line number Diff line change 10
10
11
11
use yii \base \InvalidConfigException ;
12
12
use yii \base \Model ;
13
+ use yii \base \DynamicModel ;
13
14
use yii \db \ActiveRecordInterface ;
14
15
use yii \helpers \Html ;
15
16
use unclead \multipleinput \components \BaseColumn ;
@@ -40,13 +41,14 @@ public function init()
40
41
/**
41
42
* Returns element's name.
42
43
*
43
- * @param int|null $index current row index
44
+ * @param int|null|string $index current row index
44
45
* @param bool $withPrefix whether to add prefix.
46
+ *
45
47
* @return string
46
48
*/
47
49
public function getElementName ($ index , $ withPrefix = true )
48
50
{
49
- if (is_null ( $ index) ) {
51
+ if ($ index === null ) {
50
52
$ index = '{ ' . $ this ->renderer ->getIndexPlaceholder () . '} ' ;
51
53
}
52
54
@@ -99,11 +101,17 @@ protected function hasModelAttribute($name)
99
101
100
102
if ($ model ->hasProperty ($ name )) {
101
103
return true ;
102
- } elseif ($ model instanceof ActiveRecordInterface && $ model ->hasAttribute ($ name )) {
104
+ }
105
+
106
+ if ($ model instanceof ActiveRecordInterface && $ model ->hasAttribute ($ name )) {
103
107
return true ;
104
- } else {
105
- return false ;
106
108
}
109
+
110
+ if ($ model instanceof DynamicModel && isset ($ model ->{$ name })) {
111
+ return true ;
112
+ }
113
+
114
+ return false ;
107
115
}
108
116
109
117
/**
Original file line number Diff line number Diff line change @@ -25,13 +25,13 @@ class TabularColumn extends BaseColumn
25
25
/**
26
26
* Returns element's name.
27
27
*
28
- * @param int|null $index current row index
28
+ * @param int|null|string $index current row index
29
29
* @param bool $withPrefix whether to add prefix.
30
30
* @return string
31
31
*/
32
32
public function getElementName ($ index , $ withPrefix = true )
33
33
{
34
- if (is_null ( $ index) ) {
34
+ if ($ index === null ) {
35
35
$ index = '{ ' . $ this ->renderer ->getIndexPlaceholder () . '} ' ;
36
36
}
37
37
You can’t perform that action at this time.
0 commit comments