From: Matthias Schmidt Date: Sun, 24 Feb 2019 13:31:08 +0000 (+0100) Subject: Add loadValuesFromObject support for form containers X-Git-Tag: 5.2.0_Alpha_1~274 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=dab28c5847ca637a248792ba555d94e6c9d84685;p=GitHub%2FWoltLab%2FWCF.git Add loadValuesFromObject support for form containers See #2509 --- diff --git a/wcfsetup/install/files/lib/system/form/builder/FormDocument.class.php b/wcfsetup/install/files/lib/system/form/builder/FormDocument.class.php index 7dc0ebf344..005e2e5983 100644 --- a/wcfsetup/install/files/lib/system/form/builder/FormDocument.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/FormDocument.class.php @@ -1,6 +1,7 @@ getIterator() as $node) { - if ($node instanceof IFormField && $node->isAvailable()) { - if ($node->getObjectProperty() !== $node->getId()) { - try { - $node->loadValueFromObject($object); + if ($node->isAvailable()) { + if ($node instanceof IFormField) { + if ($node->getObjectProperty() !== $node->getId()) { + try { + $node->loadValueFromObject($object); + } + catch (\InvalidArgumentException $e) { + // if an object property is explicitly set, + // ignore invalid values as this might not be + // the appropriate field + } } - catch (\InvalidArgumentException $e) { - // if an object property is explicitly set, - // ignore invalid values as this might not be - // the appropriate field + else { + $node->loadValueFromObject($object); } } - else { - $node->loadValueFromObject($object); + else if ($node instanceof IFormContainer) { + $node->loadValuesFromObject($object); } } } diff --git a/wcfsetup/install/files/lib/system/form/builder/container/FormContainer.class.php b/wcfsetup/install/files/lib/system/form/builder/container/FormContainer.class.php index 075c458bb8..ae9d6d2283 100644 --- a/wcfsetup/install/files/lib/system/form/builder/container/FormContainer.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/container/FormContainer.class.php @@ -1,5 +1,6 @@