mirror of
https://github.com/wintercms/winter.git
synced 2024-06-28 05:33:29 +02:00
Adds support for objects (relations) when reading form data
This commit is contained in:
parent
f7373da55e
commit
5091fd08c6
@ -509,10 +509,16 @@ class Form extends WidgetBase
|
||||
* This won't execute for standard field names.
|
||||
*/
|
||||
foreach ($keyParts as $key) {
|
||||
if (!is_array($result) || !array_key_exists($key, $result))
|
||||
return $defaultValue;
|
||||
|
||||
$result = $result[$key];
|
||||
if (is_array($result)) {
|
||||
if (!array_key_exists($key, $result)) return $defaultValue;
|
||||
$result = $result[$key];
|
||||
}
|
||||
else {
|
||||
if (!isset($result->{$key})) return $defaultValue;
|
||||
$result = $result->{$key};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $result;
|
||||
|
Loading…
x
Reference in New Issue
Block a user