From 4157d7d2aafe952294ab2a7d4144b1679330542b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Joshua=20R=C3=BCsweg?= Date: Sat, 19 Jan 2019 18:14:40 +0100 Subject: [PATCH] Simplify getValue method See #2826 --- .../builder/field/UploadFormField.class.php | 20 ++++--------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/wcfsetup/install/files/lib/system/form/builder/field/UploadFormField.class.php b/wcfsetup/install/files/lib/system/form/builder/field/UploadFormField.class.php index 9046e971ab..e4e2c4fa63 100644 --- a/wcfsetup/install/files/lib/system/form/builder/field/UploadFormField.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/field/UploadFormField.class.php @@ -64,22 +64,10 @@ class UploadFormField extends AbstractFormField { /** * @inheritDoc - * @return UploadFile[][] + * @return UploadFile[] */ public function getValue() { - $returnValues = [ - 'files' => UploadHandler::getInstance()->getFilesForFieldId($this->getId()), - 'newFiles' => [], - 'removedFiles' => UploadHandler::getInstance()->getRemovedFiledForFieldId($this->getId(), false) - ]; - - foreach (UploadHandler::getInstance()->getFilesForFieldId($this->getId()) as $file) { - if (!$file->isProcessed()) { - $returnValues['newFiles'][] = $file; - } - } - - return $returnValues; + return UploadHandler::getInstance()->getFilesForFieldId($this->getId()); } /** @@ -103,14 +91,14 @@ class UploadFormField extends AbstractFormField { } } - if ($this->getMinimum() !== null && count($this->getValue()['files']) < $this->getMinimum()) { + if ($this->getMinimum() !== null && count($this->getValue()) < $this->getMinimum()) { $this->addValidationError(new FormFieldValidationError( 'minimum', 'wcf.form.field.upload.error.minimum', ['minimum' => $this->getMinimum()] )); } - else if ($this->getMaximum() !== null && count($this->getValue()['files']) > $this->getMaximum()) { + else if ($this->getMaximum() !== null && count($this->getValue()) > $this->getMaximum()) { $this->addValidationError(new FormFieldValidationError( 'maximum', 'wcf.form.field.upload.error.maximum', -- 2.20.1