]> Raphaƫl G. Git Repositories - airbundle/blobdiff - Form/ImageType.php
Fix buildForm to match upstream prototype and return value
[airbundle] / Form / ImageType.php
index 300ffe9e0ca1ad80e2f4d416acc94b91dcf2af22..612adea9f2a60e22d2ee07388d6500253965c4ab 100644 (file)
@@ -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;
        }
 
        /**