Since umpteens days, I block on a problem with Symfony 2 and forms.
I got a form of websites entities. \"Websites\" is a collection of website\'s entities and each w
I've run into similar problem recently. Here's how you can override the collection prototype without having to explicitly set it in the html:
{% set customPrototype %}
{% filter escape %}
{% include 'AcmeBundle:Controller:customCollectionPrototype.html.twig' with { 'form': form.collection.vars.prototype } %}
{% endfilter %}
{% endset %}
{{ form_label(form.collection) }}
{{ form_widget(form.collection, { 'attr': { 'data-prototype': customPrototype } }) }}
You can do whatever you want then in your custom twig. For example:
{{ form_label(form.field0) }}
{{ form_widget(form.field0) }}
{{ form_label(form.field1) }}
{{ form_widget(form.field1) }}
Useful when you only have to do it in specific places and don't need a global override that's applicable to all collections.