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