From ae6ae33bfedf40bccd15afd14ebe11b2491f36e9 Mon Sep 17 00:00:00 2001 From: BooleanType Date: Sun, 26 Apr 2020 15:51:04 +0200 Subject: [PATCH] Adding an if condition on a for tag is deprecated in Twig 2.10. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I've got an error, running example from the docs. Here is the explanation: https://twig.symfony.com/doc/2.x/deprecated.html#tags I propose to use a filter filter or an “if” condition inside the “for” body instead in this docs. --- form/create_custom_field_type.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/form/create_custom_field_type.rst b/form/create_custom_field_type.rst index cc9ffe65df1..7f1df3731f1 100644 --- a/form/create_custom_field_type.rst +++ b/form/create_custom_field_type.rst @@ -405,7 +405,7 @@ libraries are used in your application: {# templates/form/custom_types.html.twig #} {% block postal_address_row %} - {% for child in form.children if not child.rendered %} + {% for child in form.children|filter(v => not v.rendered) -%}
{{ form_label(child) }} {{ form_widget(child) }}