Skip to content

Commit 74b662b

Browse files
michaelperrinxabbuh
authored andcommitted
Fix choice keys and values for custom field types
Choices labels are defined as the keys of the array as of Symfony 3 (see symfony/symfony#14050).
1 parent 814e5bd commit 74b662b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

form/create_custom_field_type.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ for form fields, which is ``<BundleName>\Form\Type``. Make sure the field extend
3232
{
3333
$resolver->setDefaults(array(
3434
'choices' => array(
35-
'standard' => 'Standard Shipping',
36-
'expedited' => 'Expedited Shipping',
37-
'priority' => 'Priority Shipping',
35+
'Standard Shipping' => 'standard',
36+
'Expedited Shipping' => 'expedited',
37+
'Priority Shipping' => 'priority',
3838
)
3939
));
4040
}
@@ -394,7 +394,7 @@ method to ``ShippingType``, which receives the shipping configuration::
394394
public function configureOptions(OptionsResolver $resolver)
395395
{
396396
$resolver->setDefaults(array(
397-
'choices' => $this->shippingOptions,
397+
'choices' => array_flip($this->shippingOptions),
398398
));
399399
}
400400

0 commit comments

Comments
 (0)