Skip to content

Commit 47ac49b

Browse files
committed
Merge pull request #1542 from michaelperrin/twig_reference_fix
[Twig reference] Changed the way label attributes are passed in examples
2 parents f0a1342 + cd71cf9 commit 47ac49b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

reference/forms/twig_reference.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ label you want to display as the second argument.
2020
{{ form_label(form.name) }}
2121
2222
{# The two following syntaxes are equivalent #}
23-
{{ form_label(form.name, 'Your Name', { 'attr': {'class': 'foo'} }) }}
24-
{{ form_label(form.name, null, { 'label': 'Your name', 'attr': {'class': 'foo'} }) }}
23+
{{ form_label(form.name, 'Your Name', {'label_attr': {'class': 'foo'}}) }}
24+
{{ form_label(form.name, null, {'label': 'Your name', 'label_attr': {'class': 'foo'}}) }}
2525
2626
form_errors(form.name)
2727
----------------------
@@ -44,7 +44,7 @@ or collection of fields, each underlying form row will be rendered.
4444
.. code-block:: jinja
4545
4646
{# render a widget, but add a "foo" class to it #}
47-
{{ form_widget(form.name, { 'attr': {'class': 'foo'} }) }}
47+
{{ form_widget(form.name, {'attr': {'class': 'foo'}}) }}
4848
4949
The second argument to ``form_widget`` is an array of variables. The most
5050
common variable is ``attr``, which is an array of HTML attributes to apply
@@ -60,7 +60,7 @@ label, errors and widget.
6060
.. code-block:: jinja
6161
6262
{# render a field row, but display a label with text "foo" #}
63-
{{ form_row(form.name, { 'label': 'foo' }) }}
63+
{{ form_row(form.name, {'label': 'foo'}) }}
6464
6565
The second argument to ``form_row`` is an array of variables. The templates
6666
provided in Symfony only allow to override the label as shown in the example

0 commit comments

Comments
 (0)