*/
public function singleFileUpload(bool $singleFileUpload = true): self
{
+ if (!$singleFileUpload && $this->bigPreview) {
+ throw new \InvalidArgumentException(
+ "Single file upload can't be disabled if the big preview is enabled for the field '{$this->getId()}'."
+ );
+ }
+
$this->singleFileUpload = $singleFileUpload;
return $this;
public function bigPreview(bool $bigPreview = true): self
{
if (
- $this->bigPreview
+ $bigPreview
&& \array_diff(
$this->getFileProcessor()->getAllowedFileExtensions($this->context),
ImageUtil::IMAGE_EXTENSIONS
"The big preview is only supported for images for the field '{$this->getId()}'."
);
}
+
+ if ($bigPreview && !$this->singleFileUpload) {
+ throw new \InvalidArgumentException(
+ "The big preview is only supported for single file uploads for the field '{$this->getId()}'."
+ );
+ }
+
$this->bigPreview = $bigPreview;
return $this;