@@ -190,21 +190,23 @@ private function addSubFields(FormBuilder $builder, array $choiceViews, array $o
190
190
if (is_array ($ choiceView )) {
191
191
// Flatten groups
192
192
$ this ->addSubFields ($ builder , $ choiceView , $ options );
193
- } elseif ($ options ['multiple ' ]) {
194
- $ builder ->add ((string ) $ i , 'checkbox ' , array (
195
- 'value ' => $ choiceView ->getValue (),
196
- 'label ' => $ choiceView ->getLabel (),
197
- // The user can check 0 or more checkboxes. If required
198
- // is true, he is required to check all of them.
199
- 'required ' => false ,
200
- 'translation_domain ' => $ options ['translation_domain ' ],
201
- ));
202
193
} else {
203
- $ builder -> add (( string ) $ i , ' radio ' , array (
194
+ $ choiceOpts = array (
204
195
'value ' => $ choiceView ->getValue (),
205
196
'label ' => $ choiceView ->getLabel (),
206
197
'translation_domain ' => $ options ['translation_domain ' ],
207
- ));
198
+ );
199
+
200
+ if ($ options ['multiple ' ]) {
201
+ $ choiceType = 'checkbox ' ;
202
+ // The user can check 0 or more checkboxes. If required
203
+ // is true, he is required to check all of them.
204
+ $ choiceOpts ['required ' ] = false ;
205
+ } else {
206
+ $ choiceType = 'radio ' ;
207
+ }
208
+
209
+ $ builder ->add ((string ) $ i , $ choiceType , $ choiceOpts );
208
210
}
209
211
}
210
212
}
0 commit comments