Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 4084a8d

Browse filesBrowse files
committed
[forms][collections] Changing how we access the prototype to be consistent with Symfony 2.1
Both the old and the new syntax work, but due to a BC break in 2.1, only the second is correct in 2.1. To add more consistency between the versions, we're documenting and recommending this change. This relates to #1486
1 parent e552a55 commit 4084a8d
Copy full SHA for 4084a8d

File tree

Expand file treeCollapse file tree

2 files changed

+5
-5
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+5
-5
lines changed

‎cookbook/form/form_collections.rst

Copy file name to clipboardExpand all lines: cookbook/form/form_collections.rst
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ new "tag" forms. To render it, make the following change to your template:
307307

308308
.. code-block:: html+jinja
309309

310-
<ul class="tags" data-prototype="{{ form_widget(form.tags.get('prototype')) | e }}">
310+
<ul class="tags" data-prototype="{{ form_widget(form.tags.vars.prototype) | e }}">
311311
...
312312
</ul>
313313

@@ -325,15 +325,15 @@ new "tag" forms. To render it, make the following change to your template:
325325

326326
.. tip::
327327

328-
The ``form.tags.get('prototype')`` is form element that looks and feels just
328+
The ``form.tags.vars.prototype`` is form element that looks and feels just
329329
like the individual ``form_widget(tag)`` elements inside our ``for`` loop.
330330
This means that you can call ``form_widget``, ``form_row``, or ``form_label``
331331
on it. You could even choose to render only one of its fields (e.g. the
332332
``name`` field):
333333

334334
.. code-block:: html+jinja
335335

336-
{{ form_widget(form.tags.get('prototype').name) | e }}
336+
{{ form_widget(form.tags.vars.prototype.name) | e }}
337337

338338
On the rendered page, the result will look something like this:
339339

‎reference/forms/types/collection.rst

Copy file name to clipboardExpand all lines: reference/forms/types/collection.rst
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ you need is the JavaScript:
146146
{# ... #}
147147

148148
{# store the prototype on the data-prototype attribute #}
149-
<ul id="email-fields-list" data-prototype="{{ form_widget(form.emails.get('prototype')) | e }}">
149+
<ul id="email-fields-list" data-prototype="{{ form_widget(form.emails.vars.prototype) | e }}">
150150
{% for emailField in form.emails %}
151151
<li>
152152
{{ form_errors(emailField) }}
@@ -295,7 +295,7 @@ collection field:
295295

296296
.. code-block:: jinja
297297
298-
{{ form_row(form.emails.get('prototype')) }}
298+
{{ form_row(form.emails.vars.prototype) }}
299299
300300
.. code-block:: php
301301

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.