Skip to content

Commit

Permalink
Fix disable required constraint for hidden and spacer field (#385)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-schranz authored Jun 6, 2024
1 parent cc80e6e commit 0eb960a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Form/Type/DynamicFormType.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 0eb960a

Please sign in to comment.