Closed
Description
Symfony version(s) affected: 4.2.0
Description
When the form_div_layout.html.twig file is used for form theming, a collection widget will try to render its 'prototype' property, regardless of whether it has already been rendered elsewhere (ie. by a custom extending theme). This causes an E_USER_DEPRECATED error to be triggered by the FormRenderer.
How to reproduce
Create a form theme file similar to this:
{% use 'form_div_layout.html.twig' %}
{% block _mycollection_row %}
<div class="my-collection-container" data-prototype="{{ form_row(form.vars.prototype)|e('html_attr') }}">
{{ form_widget(form) }}
</div>
{% endblock %}
Applying the theme should trigger the aforementioned deprecation error.
Possible Solution
Fixable by simply not rendering the prototype if it's already been rendered: 7011706