X-Git-Url: https://git.rapsys.eu/.gitweb.cgi/airbundle/blobdiff_plain/2cc6a0575e16de90494f22c0b77c960af3d185dd..1be898ed564b18e6ac635d4d605efd7a388991b3:/Form/ImageType.php diff --git a/Form/ImageType.php b/Form/ImageType.php index 300ffe9..612adea 100644 --- a/Form/ImageType.php +++ b/Form/ImageType.php @@ -26,7 +26,7 @@ class ImageType extends AbstractType { /** * {@inheritdoc} */ - public function buildForm(FormBuilderInterface $form, array $options): FormBuilderInterface { + public function buildForm(FormBuilderInterface $form, array $options): void { //With location if ($options['location']) { $form->add('location', HiddenType::class, ['required' => true]); @@ -40,7 +40,7 @@ class ImageType extends AbstractType { //With image if ($options['image']) { //With image - $form->add('image', FileType::class, ['attr' => ['placeholder' => 'Your image'], 'constraints' => [new File(['maxSize' => '5M', 'mimeTypes' => ['image/jpeg', 'image/png', 'image/tiff', 'image/webp'], 'mimeTypesMessage' => 'Please upload a valid Image document'])]/*, 'mapped' => false*/, 'required' => $options['delete'] ? false : true]); + $form->add('image', FileType::class, ['attr' => ['placeholder' => 'Your image'], 'constraints' => [new File(null, '5M', null, ['image/jpeg', 'image/png', 'image/tiff', 'image/webp'], null, null, null, null, 'Please upload a valid Image document')]/*, 'mapped' => false*/, 'required' => $options['delete'] ? false : true]); } //Add submit @@ -52,9 +52,6 @@ class ImageType extends AbstractType { //TODO: add confirm on click ? $form->add('delete', SubmitType::class, ['label' => 'Delete', 'attr' => ['class' => 'submit']]); } - - //Return form builder - return $form; } /**