From 32c6dd21539c62d2037cab8d162530ec0965b37d Mon Sep 17 00:00:00 2001 From: Tomasz Kryszan Date: Tue, 31 Oct 2023 13:21:15 +0100 Subject: [PATCH] IBX-6937: Used NumberType field to set max image size in ImageFormMapper https://issues.ibexa.co/browse/IBX-6937 --- src/lib/FieldType/Mapper/ImageFormMapper.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/lib/FieldType/Mapper/ImageFormMapper.php b/src/lib/FieldType/Mapper/ImageFormMapper.php index bb6df64d18..a9a3f0d842 100644 --- a/src/lib/FieldType/Mapper/ImageFormMapper.php +++ b/src/lib/FieldType/Mapper/ImageFormMapper.php @@ -12,7 +12,7 @@ use Ibexa\Contracts\Core\Repository\FieldTypeService; use JMS\TranslationBundle\Annotation\Desc; use Symfony\Component\Form\Extension\Core\Type\CheckboxType; -use Symfony\Component\Form\Extension\Core\Type\IntegerType; +use Symfony\Component\Form\Extension\Core\Type\NumberType; use Symfony\Component\Form\FormInterface; use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\Validator\Constraints\Range; @@ -31,7 +31,7 @@ public function mapFieldDefinitionForm(FormInterface $fieldDefinitionForm, Field { $isTranslation = $data->contentTypeData->languageCode !== $data->contentTypeData->mainLanguageCode; $fieldDefinitionForm - ->add('maxSize', IntegerType::class, [ + ->add('maxSize', NumberType::class, [ 'required' => false, 'property_path' => 'validatorConfiguration[FileSizeValidator][maxFileSize]', 'label' => /** @Desc("Maximum file size (MB)") */ 'field_definition.ezimage.max_file_size', @@ -46,6 +46,7 @@ public function mapFieldDefinitionForm(FormInterface $fieldDefinitionForm, Field 'max' => $this->maxUploadSize->get(MaxUploadSize::MEGABYTES), ], 'disabled' => $isTranslation, + 'scale' => 1, ]) ->add('isAlternativeTextRequired', CheckboxType::class, [ 'required' => false,