Reputation: 369
I built a form in symfony with this code:
foreach ( $options as $field => $title ) {
$form->add( $field, 'text', array('label' => $title, 'mapped' => false ) );
}
And I can't find a way to render all the rows of this form in twig.
Is this possible?
Upvotes: 2
Views: 1574
Reputation: 369
Ok. I've found how to do this. In Twig:
{% for child in form.children|keys %}
{{ form_row(attribute(form.children,child)) }}
{% endfor %}
Upvotes: 5
Reputation: 1683
Are you looking for something like this : ?
{{ form(form) }}
or
{{ form_widget(form) }}
http://symfony.com/doc/current/cookbook/form/form_customization.html
Upvotes: 1