From 0eb960ade3c70b9554dd1348f2de19a1504d7083 Mon Sep 17 00:00:00 2001 From: Alexander Schranz Date: Thu, 6 Jun 2024 16:08:35 +0200 Subject: [PATCH] Fix disable required constraint for hidden and spacer field (#385) --- Form/Type/DynamicFormType.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Form/Type/DynamicFormType.php b/Form/Type/DynamicFormType.php index d4567a3c..f2d1b939 100644 --- a/Form/Type/DynamicFormType.php +++ b/Form/Type/DynamicFormType.php @@ -15,6 +15,7 @@ use Sulu\Bundle\FormBundle\Dynamic\FormFieldTypePool; use Sulu\Bundle\FormBundle\Dynamic\Types\FreeTextType; use Sulu\Bundle\FormBundle\Dynamic\Types\HeadlineType; +use Sulu\Bundle\FormBundle\Dynamic\Types\SpacerType; use Sulu\Bundle\FormBundle\Entity\Dynamic; use Sulu\Bundle\FormBundle\Entity\Form; use Sulu\Bundle\FormBundle\Exception\FormNotFoundException; @@ -121,6 +122,8 @@ public function buildForm(FormBuilderInterface $builder, array $options) if ( !$formFieldType instanceof FreeTextType && !$formFieldType instanceof HeadlineType + && !$formFieldType instanceof \Sulu\Bundle\FormBundle\Dynamic\Types\HiddenType + && !$formFieldType instanceof SpacerType && $field->getRequired() ) { $options['constraints'][] = new NotBlank();