Rename the setter function
authorCyperghost <olaf_schmitz_1@t-online.de>
Wed, 19 Jun 2024 09:41:48 +0000 (11:41 +0200)
committerCyperghost <olaf_schmitz_1@t-online.de>
Wed, 19 Jun 2024 09:41:48 +0000 (11:41 +0200)
wcfsetup/install/files/lib/system/form/builder/field/FileProcessorFormField.class.php

index 3a60744312ac650e766f189ddfd1f29a7d27f034..dfd9d1531f9a3e7c364d709aa46e19c6fc4ee709 100644 (file)
@@ -88,7 +88,7 @@ final class FileProcessorFormField extends AbstractFormField
      * If set to true, the value of the field will be an integer.
      * Otherwise, the value will be an array of integers.
      */
-    public function setSingleFileUpload(bool $singleFileUpload): self
+    public function singleFileUpload(bool $singleFileUpload = true): self
     {
         $this->singleFileUpload = $singleFileUpload;
 
@@ -129,11 +129,13 @@ final class FileProcessorFormField extends AbstractFormField
             $fileIDs = $fileList->getObjectIDs();
         }
 
-        $thumbnailList = new FileThumbnailList();
-        $thumbnailList->getConditionBuilder()->add("fileID IN (?)", [$fileIDs]);
-        $thumbnailList->readObjects();
-        foreach ($thumbnailList as $thumbnail) {
-            $this->files[$thumbnail->fileID]->addThumbnail($thumbnail);
+        if ($fileIDs !== []) {
+            $thumbnailList = new FileThumbnailList();
+            $thumbnailList->getConditionBuilder()->add("fileID IN (?)", [$fileIDs]);
+            $thumbnailList->readObjects();
+            foreach ($thumbnailList as $thumbnail) {
+                $this->files[$thumbnail->fileID]->addThumbnail($thumbnail);
+            }
         }
 
         return parent::value($value);