File tree 1 file changed +23
-0
lines changed
modules/backend/formwidgets
1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change 1
1
<?php namespace Backend \FormWidgets ;
2
2
3
3
use Backend \Classes \FormWidgetBase ;
4
+ use Winter \Storm \Html \Helper as HtmlHelper ;
4
5
5
6
/**
6
7
* Sensitive widget.
@@ -94,6 +95,28 @@ public function onShowValue()
94
95
];
95
96
}
96
97
98
+ /**
99
+ * @inheritDoc
100
+ */
101
+ public function getLoadValue ()
102
+ {
103
+ if ($ this ->formField ->value !== null && $ this ->formField ->value != $ this ->hiddenPlaceholder ) {
104
+ return $ this ->formField ->value ;
105
+ }
106
+
107
+ $ parts = HtmlHelper::nameToArray ($ this ->getFieldName ());
108
+ array_shift ($ parts ); // remove Model name
109
+ $ fieldName = array_shift ($ parts );
110
+
111
+ $ value = $ this ->model ->getAttribute ($ fieldName );
112
+
113
+ if (count ($ parts ) && is_array ($ value )) {
114
+ $ value = array_get ($ value , implode ('. ' , $ parts ));
115
+ }
116
+
117
+ return $ value ;
118
+ }
119
+
97
120
/**
98
121
* @inheritDoc
99
122
*/
You can’t perform that action at this time.
0 commit comments