Skip to content

Commit

Permalink
IBX-6937: Used NumberType field to set max image size in ImageFormMapper
Browse files Browse the repository at this point in the history
  • Loading branch information
ciastektk committed Nov 30, 2023
1 parent c04f138 commit 32c6dd2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/lib/FieldType/Mapper/ImageFormMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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',
Expand All @@ -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,
Expand Down

0 comments on commit 32c6dd2

Please sign in to comment.