Skip to content

Commit b29e238

Browse files
committed
[Form] Document using TranslatableMessage in form Fields
1 parent f1c0f13 commit b29e238

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
``label``
22
~~~~~~~~~
33

4-
**type**: ``string`` **default**: The label is "guessed" from the field name
4+
**type**: ``string`` or ``TranslatableMessage`` **default**: The label is "guessed" from the field name
55

66
Sets the label that will be displayed on the button. The label can also
77
be directly set inside the template:

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
``placeholder``
22
~~~~~~~~~~~~~~~
33

4-
**type**: ``string`` or ``boolean``
4+
**type**: ``string`` or ``TranslatableMessage`` or ``boolean``
55

66
This option determines whether or not a special "empty" option (e.g. "Choose
77
an option") will appear at the top of a select widget. This option only
@@ -14,6 +14,9 @@ applies if the ``multiple`` option is set to false.
1414

1515
$builder->add('states', ChoiceType::class, [
1616
'placeholder' => 'Choose an option',
17+
18+
// or if you want to translate the text
19+
'placeholder' => new TranslatableMessage('form.placeholder.select_option', [], 'form'),
1720
]);
1821

1922
* Guarantee that no "empty" value option is displayed::

0 commit comments

Comments
 (0)