]> Raphaël G. Git Repositories - userbundle/commitdiff
Fix civility to have default value and not forced value
authorRaphaël Gertz <git@rapsys.eu>
Wed, 11 Aug 2021 18:41:17 +0000 (20:41 +0200)
committerRaphaël Gertz <git@rapsys.eu>
Wed, 11 Aug 2021 18:41:17 +0000 (20:41 +0200)
Form/RegisterType.php

index bfedcf72faa6278eb6a3ca2f088db05d94b4b15b..f4327c0f27b3bd95fbe9e6fd9695109ab3901160 100644 (file)
@@ -21,6 +21,7 @@ class RegisterType extends AbstractType {
         * {@inheritdoc}
         */
        public function buildForm(FormBuilderInterface $builder, array $options) {
+               //Create form
                $form = $builder;
 
                //Add extra mail field
@@ -30,7 +31,7 @@ class RegisterType extends AbstractType {
 
                //Add extra civility field
                if (!empty($options['civility'])) {
-                       $form->add('civility', EntityType::class, ['class' => $options['civility_class'], 'attr' => ['placeholder' => 'Your civility'], 'constraints' => [new NotBlank(['message' => 'Please provide your civility'])], 'choice_translation_domain' => true, 'data' => $options['civility_default']]);
+                       $form->add('civility', EntityType::class, ['class' => $options['civility_class'], 'attr' => ['placeholder' => 'Your civility'], 'constraints' => [new NotBlank(['message' => 'Please provide your civility'])], 'choice_translation_domain' => true, 'empty_data' => $options['civility_default']]);
                }
 
                //Add extra pseudonym field