Show maximum allowed file size below the upload field for attachments

This commit is contained in:
Jan Böhmer 2023-03-02 23:38:23 +01:00
parent 6fa5efc4ca
commit e0635f7ead
10 changed files with 2572 additions and 2487 deletions

View file

@ -37,6 +37,8 @@ use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormError;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormView;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
@ -168,6 +170,11 @@ class AttachmentFormType extends AbstractType
]);
}
public function finishView(FormView $view, FormInterface $form, array $options)
{
$view->vars['max_upload_size'] = $this->submitHandler->getMaximumAllowedUploadSize();
}
public function getBlockPrefix(): string
{
return 'attachment';