Skip to content

Commit c7444dd

Browse files
committed
Minor tweaks
1 parent 4d51f28 commit c7444dd

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

reference/forms/types/options/choice_label.rst.inc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ more control::
2929
},
3030
]);
3131

32+
.. versionadded:: 5.2
33+
34+
The support for ``TranslatableMessage`` objects in ``choice_label`` was
35+
introduced in Symfony 5.2.
36+
3237
This method is called for *each* choice, passing you the ``$choice`` and
3338
``$key`` from the choices array (additional ``$value`` is related to `choice_value`_).
3439
This will give you:

reference/forms/types/options/label.rst.inc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ will suppress the label.
1111
$builder
1212
->add('zipCode', null, [
1313
'label' => 'The ZIP/Postal code',
14+
// optionally, you can use TranslatableMessage objects as the label content
15+
'label' => new TranslatableMessage('address.zipCode', ['%country%' => $country], 'address'),
1416
])
1517

16-
// ...
18+
.. versionadded:: 5.2
1719

18-
->add('zipCode', null, [
19-
'label' => new TranslatableMessage('address.zipCode', ['%country%' => $country], 'address'),
20-
])
21-
;
20+
The support for ``TranslatableMessage`` objects in ``label`` was
21+
introduced in Symfony 5.2.
2222

2323
The label can also be set in the template:
2424

0 commit comments

Comments
 (0)