You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$choiceLabel = function (Options$options) use (&$choiceLabels) {
273
+
// If the choices contain duplicate labels, the normalizer of the
274
+
// "choices" option stores them in the $choiceLabels variable
275
+
276
+
// Trigger the normalizer
277
+
$options->offsetGet('choices');
278
+
279
+
// Pick labels from $choiceLabels if available
280
+
// Don't invoke count() to avoid creating a copy of the array (yet)
281
+
if ($choiceLabels) {
282
+
// Don't pass the labels by reference. We do want to create a
283
+
// copy here so that every form has an own version of that
284
+
// variable (contrary to the global reference shared by all
285
+
// forms)
286
+
returnfunction ($choice, $key) use ($choiceLabels) {
287
+
return$choiceLabels[$key];
288
+
};
289
+
}
290
+
291
+
return;
292
+
};
293
+
255
294
$choiceListNormalizer = function (Options$options, $choiceList) use ($choiceListFactory) {
256
295
if ($choiceList) {
257
296
@trigger_error('The "choice_list" option is deprecated since version 2.7 and will be removed in 3.0. Use "choice_loader" instead.', E_USER_DEPRECATED);
@@ -322,7 +361,7 @@ public function configureOptions(OptionsResolver $resolver)
322
361
'choices' => array(),
323
362
'choices_as_values' => false,
324
363
'choice_loader' => null,
325
-
'choice_label' => null,
364
+
'choice_label' => $choiceLabel,
326
365
'choice_name' => null,
327
366
'choice_value' => null,
328
367
'choice_attr' => null,
@@ -340,6 +379,7 @@ public function configureOptions(OptionsResolver $resolver)
0 commit comments