@@ -69,47 +69,25 @@ address as its own input text box::
6969
7070The simplest way to render this is all at once:
7171
72- .. configuration -block ::
72+ .. code -block :: twig
7373
74- .. code-block :: twig
75-
76- {{ form_row(form.emails) }}
77-
78- .. code-block :: php
79-
80- <?php echo $view['form']->row($form['emails']) ?>
74+ {{ form_row(form.emails) }}
8175
8276 A much more flexible method would look like this:
8377
84- .. configuration-block ::
85-
86- .. code-block :: html+twig
87-
88- {{ form_label(form.emails) }}
89- {{ form_errors(form.emails) }}
90-
91- <ul>
92- {% for emailField in form.emails %}
93- <li>
94- {{ form_errors(emailField) }}
95- {{ form_widget(emailField) }}
96- </li>
97- {% endfor %}
98- </ul>
99-
100- .. code-block :: html+php
78+ .. code-block :: html+twig
10179
102- <?php echo $view['form']->label($ form[' emails']) ?>
103- <?php echo $view['form']->errors($ form[' emails']) ?>
80+ {{ form_label( form. emails) }}
81+ {{ form_errors( form. emails) }}
10482
105- <ul>
106- <?php foreach ($ form[' emails'] as $emailField): ?>
107- <li>
108- <?php echo $view['form']->errors($ emailField) ?>
109- <?php echo $view['form']->widget($ emailField) ?>
110- </li>
111- <?php endforeach ?>
112- </ul>
83+ <ul>
84+ {% for emailField in form. emails %}
85+ <li>
86+ {{ form_errors( emailField) }}
87+ {{ form_widget( emailField) }}
88+ </li>
89+ {% endfor %}
90+ </ul>
11391
11492In both cases, no input fields would render unless your ``emails `` data
11593array already contained some emails.
@@ -368,15 +346,9 @@ be added to your underlying array due to the `allow_add`_ option.
368346The prototype field can be rendered via the ``prototype `` variable in the
369347collection field:
370348
371- .. configuration-block ::
372-
373- .. code-block :: twig
374-
375- {{ form_row(form.emails.vars.prototype) }}
376-
377- .. code-block :: php
349+ .. code-block :: twig
378350
379- <?php echo $view['form']->row($ form[' emails']-> vars[' prototype']) ?>
351+ {{ form_row( form. emails. vars. prototype) }}
380352
381353 Note that all you really need is the "widget", but depending on how you're
382354rendering your form, having the entire "form row" may be easier for you.
0 commit comments