Skip to content

Commit 1ce98c2

Browse files
committed
minor #13594 Adding an if condition on a for tag is deprecated in Twig 2.10. (BooleanType)
This PR was submitted for the 5.0 branch but it was merged into the 4.4 branch instead. Discussion ---------- Adding an if condition on a for tag is deprecated in Twig 2.10. 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. <!-- If your pull request fixes a BUG, use the oldest maintained branch that contains the bug (see https://symfony.com/roadmap for the list of maintained branches). If your pull request documents a NEW FEATURE, use the same Symfony branch where the feature was introduced (and `master` for features of unreleased versions). --> Commits ------- ae6ae33 Adding an if condition on a for tag is deprecated in Twig 2.10.
2 parents 811df86 + ae6ae33 commit 1ce98c2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

form/create_custom_field_type.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ libraries are used in your application:
405405

406406
{# templates/form/custom_types.html.twig #}
407407
{% block postal_address_row %}
408-
{% for child in form.children if not child.rendered %}
408+
{% for child in form.children|filter(v => not v.rendered) -%}
409409
<div class="form-group">
410410
{{ form_label(child) }}
411411
{{ form_widget(child) }}

0 commit comments

Comments
 (0)