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 1010
1111use yii \base \InvalidConfigException ;
1212use yii \base \Model ;
13+ use yii \base \DynamicModel ;
1314use yii \db \ActiveRecordInterface ;
1415use yii \helpers \Html ;
1516use unclead \multipleinput \components \BaseColumn ;
@@ -40,13 +41,14 @@ public function init()
4041 /**
4142 * Returns element's name.
4243 *
43- * @param int|null $index current row index
44+ * @param int|null|string $index current row index
4445 * @param bool $withPrefix whether to add prefix.
46+ *
4547 * @return string
4648 */
4749 public function getElementName ($ index , $ withPrefix = true )
4850 {
49- if (is_null ( $ index) ) {
51+ if ($ index === null ) {
5052 $ index = '{ ' . $ this ->renderer ->getIndexPlaceholder () . '} ' ;
5153 }
5254
@@ -99,11 +101,17 @@ protected function hasModelAttribute($name)
99101
100102 if ($ model ->hasProperty ($ name )) {
101103 return true ;
102- } elseif ($ model instanceof ActiveRecordInterface && $ model ->hasAttribute ($ name )) {
104+ }
105+
106+ if ($ model instanceof ActiveRecordInterface && $ model ->hasAttribute ($ name )) {
103107 return true ;
104- } else {
105- return false ;
106108 }
109+
110+ if ($ model instanceof DynamicModel && isset ($ model ->{$ name })) {
111+ return true ;
112+ }
113+
114+ return false ;
107115 }
108116
109117 /**
Original file line number Diff line number Diff line change @@ -25,13 +25,13 @@ class TabularColumn extends BaseColumn
2525 /**
2626 * Returns element's name.
2727 *
28- * @param int|null $index current row index
28+ * @param int|null|string $index current row index
2929 * @param bool $withPrefix whether to add prefix.
3030 * @return string
3131 */
3232 public function getElementName ($ index , $ withPrefix = true )
3333 {
34- if (is_null ( $ index) ) {
34+ if ($ index === null ) {
3535 $ index = '{ ' . $ this ->renderer ->getIndexPlaceholder () . '} ' ;
3636 }
3737
You can’t perform that action at this time.
0 commit comments