From cb99074d1f25ca805ef11d1ff3d8be77e8829ad4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Tue, 13 Jul 2021 16:58:17 +0200 Subject: [PATCH] fix custom field wich could not be saved --- .../ChillCustomFieldsBundle/Form/Type/ChoiceWithOtherType.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Bundle/ChillCustomFieldsBundle/Form/Type/ChoiceWithOtherType.php b/src/Bundle/ChillCustomFieldsBundle/Form/Type/ChoiceWithOtherType.php index 15a2e4a22..b54b69d02 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Form/Type/ChoiceWithOtherType.php +++ b/src/Bundle/ChillCustomFieldsBundle/Form/Type/ChoiceWithOtherType.php @@ -22,13 +22,12 @@ class ChoiceWithOtherType extends AbstractType */ public function buildForm(FormBuilderInterface $builder, array $options) { - //add an 'other' entry in choices array $options['choices'][$this->otherValueLabel] = '_other'; //ChoiceWithOther must always be expanded $options['expanded'] = true; // adding a default value for choice - $options['empty_data'] = null; + $options['empty_data'] = $options['multiple'] ? [] : null; $builder ->add('_other', TextType::class, array('required' => false))