From: Cyperghost Date: Wed, 31 Jul 2024 05:57:28 +0000 (+0200) Subject: Adds a FieldDataProcessor to insert into the fileIDs to the `$parameters` array X-Git-Tag: 6.1.0_Alpha_1~30 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=9ea83d23a64a4189684e6b3714a57fc66a06b17f;p=GitHub%2FWoltLab%2FWCF.git Adds a FieldDataProcessor to insert into the fileIDs to the `$parameters` array --- diff --git a/wcfsetup/install/files/lib/system/form/builder/field/FileProcessorFormField.class.php b/wcfsetup/install/files/lib/system/form/builder/field/FileProcessorFormField.class.php index 3038e92020..500353548f 100644 --- a/wcfsetup/install/files/lib/system/form/builder/field/FileProcessorFormField.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/field/FileProcessorFormField.class.php @@ -7,7 +7,9 @@ use wcf\data\file\FileList; use wcf\data\file\thumbnail\FileThumbnailList; use wcf\system\file\processor\FileProcessor; use wcf\system\file\processor\IFileProcessor; +use wcf\system\form\builder\data\processor\CustomFormDataProcessor; use wcf\system\form\builder\field\validation\FormFieldValidationError; +use wcf\system\form\builder\IFormDocument; use wcf\system\form\builder\TObjectTypeFormNode; use wcf\system\style\IFontAwesomeIcon; use wcf\util\ArrayUtil; @@ -79,6 +81,29 @@ final class FileProcessorFormField extends AbstractFormField ]; } + #[\Override] + public function populate() + { + parent::populate(); + + if ($this->isSingleFileUpload()) { + return $this; + } + + $this->getDocument()->getDataHandler()->addProcessor( + new CustomFormDataProcessor( + 'fileProcessor', + function (IFormDocument $document, array $parameters) { + $parameters[$this->getObjectProperty()] = $this->getValue(); + + return $parameters; + } + ) + ); + + return $this; + } + public function getFileProcessor(): IFileProcessor { return $this->getObjectType()->getProcessor();