The URL field of an attachment must contain a valid url.

This commit is contained in:
Jan Böhmer 2019-08-27 13:17:19 +02:00
parent eea81441fb
commit f98ed076ce

View file

@ -45,6 +45,7 @@ use Symfony\Component\Form\Extension\Core\Type\UrlType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Validator\Constraints\File;
use Symfony\Component\Validator\Constraints\Url;
class AttachmentFormType extends AbstractType
{
@ -74,7 +75,10 @@ class AttachmentFormType extends AbstractType
$builder->add('url', UrlType::class, [
'label' => 'attachment.edit.url',
'required' => false
'required' => false,
'constraints' => [
new Url()
]
]);
$builder->add('file', FileType::class, [