You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: cookbook/form/form_collections.rst
+10Lines changed: 10 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -743,3 +743,13 @@ But if you are in the situation were you need to have a complete custom prototyp
743
743
744
744
.. code-block:: html+jinja
745
745
data-prototype="{% filter escape %}{% include 'AcmeTaskBundle:Task:prototypeTask.html.twig' with { 'form': form.task.get('prototype') } %}{% endfilter %}"
746
+
747
+
The included `AcmeTaskBundle:Task:prototypeTask.html.twig` contains the markup used for the prototype. This way you can not only easily structure your prototype-markup, you can
748
+
also use this markup to render the contents of the collection when it already holds items:
749
+
750
+
.. code-block:: html+jinja
751
+
{% for task in tasks %}
752
+
{% include 'AcmeTaskBundle:Task:prototypeTask.html.twig' with { 'form': form.task.vars.form } %}
753
+
{% endfor %}
754
+
755
+
This makes sure the displayed items are the same as the newly inserted from the prototype.
0 commit comments