Skip to content

Commit 1e19b33

Browse files
committed
minor #15527 [Form] Document using TranslatableMessage in form help (javiereguiluz)
This PR was squashed before being merged into the 5.4 branch. Discussion ---------- [Form] Document using TranslatableMessage in form help Fixes #15482. Commits ------- a6d4c40 [Form] Document using TranslatableMessage in form help
2 parents 765a6e0 + a6d4c40 commit 1e19b33

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed
Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,25 @@
11
help
22
~~~~
33

4-
**type**: ``string`` **default**: null
4+
**type**: ``string`` or ``TranslatableMessage`` **default**: null
55

66
Allows you to define a help message for the form field, which by default is
77
rendered below the field::
88

9-
$builder->add('zipCode', null, [
10-
'help' => 'The ZIP/Postal code for your credit card\'s billing address.',
11-
]);
9+
use Symfony\Component\Translation\TranslatableMessage;
10+
11+
$builder
12+
->add('zipCode', null, [
13+
'help' => 'The ZIP/Postal code for your credit card\'s billing address.',
14+
])
15+
16+
// ...
17+
18+
->add('status', null, [
19+
'help' => new TranslatableMessage('order.status', ['%order_id%' => $order->getId()], 'store'),
20+
])
21+
;
22+
23+
.. versionadded:: 5.4
24+
25+
Support for passing ``TranslatableMessage`` objects was introduced in Symfony 5.4.

0 commit comments

Comments
 (0)