Unexpected token "name" of value "if"

Created on 14 February 2024, 9 months ago
Updated 12 August 2024, 3 months ago

Problem/Motivation

Several templates still use the deprecated if in a for statement:
{% for key, coupon in form.coupons if key|first != '#' %}
This causes errors in Twig 3.x / Drupal 10.2.

Affected templates:
- /templates/commerce/promotion/commerce-coupon-redemption-form.html.twig
- /templates/dataset/forum-list.html.twig
- /templates/layout/book-export-html.html.twig

Proposed resolution

- Rewrite to use "filter" (https://twig.symfony.com/doc/3.x/filters/filter.html) or move if outside loop

Remaining tasks

- Review

User interface changes

None

API changes

None

Data model changes

None

🐛 Bug report
Status

Fixed

Version

5.1

Component

Code

Created by

🇨🇭Switzerland pvbergen

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024