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
+
if (count($choiceLabels) > 0) {
281
+
returnfunction ($choice, $key) use ($choiceLabels) {
282
+
return$choiceLabels[$key];
283
+
};
284
+
}
285
+
286
+
returnnull;
287
+
};
288
+
255
289
$choiceListNormalizer = function (Options$options, $choiceList) use ($choiceListFactory) {
256
290
if ($choiceList) {
257
291
@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 +356,7 @@ public function configureOptions(OptionsResolver $resolver)
322
356
'choices' => array(),
323
357
'choices_as_values' => false,
324
358
'choice_loader' => null,
325
-
'choice_label' => null,
359
+
'choice_label' => $choiceLabel,
326
360
'choice_name' => null,
327
361
'choice_value' => null,
328
362
'choice_attr' => null,
@@ -340,6 +374,7 @@ public function configureOptions(OptionsResolver $resolver)
0 commit comments