From: Matthias Schmidt Date: Wed, 9 Oct 2019 17:03:27 +0000 (+0200) Subject: Fix `MultipleSelectionFormField` save value handling X-Git-Tag: 5.2.0_Beta_3~41 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=0bb62eb9456527afbcc6a66b35bbe89036f919cc;p=GitHub%2FWoltLab%2FWCF.git Fix `MultipleSelectionFormField` save value handling As `MultipleSelectionFormField` works with arrays, it does not return an actual save value for the `data` subarray but must populate an additional entry in the parameters array itself. --- diff --git a/wcfsetup/install/files/lib/system/form/builder/field/MultipleSelectionFormField.class.php b/wcfsetup/install/files/lib/system/form/builder/field/MultipleSelectionFormField.class.php index 484fe87d79..bb5b5975ec 100644 --- a/wcfsetup/install/files/lib/system/form/builder/field/MultipleSelectionFormField.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/field/MultipleSelectionFormField.class.php @@ -1,6 +1,8 @@ getDocument()->getDataHandler()->addProcessor( + new CustomFormDataProcessor( + 'multiple', + function(IFormDocument $document, array $parameters) { + if ($this->checkDependencies() && !empty($this->getValue())) { + $parameters[$this->getObjectProperty()] = $this->getValue(); + } + + return $parameters; + } + ) + ); + + return $this; + } + /** * @inheritDoc */ diff --git a/wcfsetup/install/files/lib/system/package/plugin/BoxPackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/BoxPackageInstallationPlugin.class.php index d0738ff9af..a4831f92f3 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/BoxPackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/BoxPackageInstallationPlugin.class.php @@ -817,13 +817,13 @@ class BoxPackageInstallationPlugin extends AbstractXMLPackageInstallationPlugin $form ); - if (!empty($data['visibilityExceptions'])) { + if (!empty($formData['visibilityExceptions'])) { $box->appendChild($document->createElement('visibleEverywhere', (string)($data['visibleEverywhere'] ?? 0))); $visibilityExceptions = $document->createElement('visibilityExceptions'); - sort($data['visibilityExceptions']); - foreach ($data['visibilityExceptions'] as $page) { + sort($formData['visibilityExceptions']); + foreach ($formData['visibilityExceptions'] as $page) { $visibilityExceptions->appendChild($document->createElement('page', $page)); } diff --git a/wcfsetup/install/files/lib/system/package/plugin/MenuPackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/MenuPackageInstallationPlugin.class.php index 9cd6cf3420..fed23cc0fb 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/MenuPackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/MenuPackageInstallationPlugin.class.php @@ -555,10 +555,11 @@ class MenuPackageInstallationPlugin extends AbstractXMLPackageInstallationPlugin } } - if (!empty($formData['data']['boxVisibilityExceptions'])) { + if (!empty($formData['boxVisibilityExceptions'])) { $visibilityExceptions = $box->appendChild($document->createElement('visibilityExceptions')); - foreach ($formData['data']['boxVisibilityExceptions'] as $pageIdentifier) { + sort($formData['boxVisibilityExceptions']); + foreach ($formData['boxVisibilityExceptions'] as $pageIdentifier) { $visibilityExceptions->appendChild($document->createElement('page', $pageIdentifier)); } }