Fixes #761 - Widgets can support proxy fields too
This commit is contained in:
parent
3dbe487698
commit
78c5a6af5d
|
|
@ -803,13 +803,15 @@ class Form extends WidgetBase
|
||||||
* Give widgets an opportunity to process the data.
|
* Give widgets an opportunity to process the data.
|
||||||
*/
|
*/
|
||||||
foreach ($this->formWidgets as $field => $widget) {
|
foreach ($this->formWidgets as $field => $widget) {
|
||||||
$widgetValue = array_key_exists($field, $data)
|
$parts = Str::evalHtmlArray($field);
|
||||||
? $data[$field]
|
$dotted = implode('.', $parts);
|
||||||
: null;
|
|
||||||
|
|
||||||
$data[$field] = $widget->getSaveData($widgetValue);
|
$widgetValue = $widget->getSaveData(array_get($data, $dotted));
|
||||||
if ($data[$field] === FormWidgetBase::NO_SAVE_DATA) {
|
if ($widgetValue === FormWidgetBase::NO_SAVE_DATA) {
|
||||||
unset($data[$field]);
|
array_forget($data, $dotted);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
array_set($data, $dotted, $widgetValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue