From 654f7b4d268b99d4a03213f5993b37584046491b Mon Sep 17 00:00:00 2001 From: nobohan Date: Wed, 11 Apr 2018 17:48:31 +0200 Subject: [PATCH] flip value for 'other' --- Form/Type/ChoiceWithOtherType.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Form/Type/ChoiceWithOtherType.php b/Form/Type/ChoiceWithOtherType.php index b787ad4f6..ca57063d5 100644 --- a/Form/Type/ChoiceWithOtherType.php +++ b/Form/Type/ChoiceWithOtherType.php @@ -28,8 +28,10 @@ class ChoiceWithOtherType extends AbstractType */ public function buildForm(FormBuilderInterface $builder, array $options) { + + //$otherValueLabel = $options['other_value_label']; //add an 'other' entry in choices array - $options['choices']['_other'] = $this->otherValueLabel; + $options['choices'][$this->otherValueLabel] = '_other'; //ChoiceWithOther must always be expanded $options['expanded'] = true; // adding a default value for choice @@ -50,6 +52,7 @@ class ChoiceWithOtherType extends AbstractType $resolver ->setRequired(array('choices')) ->setAllowedTypes('choices', array('array')) + //->setDefault('other_value_label', null) ->setDefaults(array( 'multiple' => false, ))