Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By catch on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
10.0.x
Introduced in version:
10.0.0
Issue links:
Description:
Twig has been updated from version 2 to 3.
Ensuring that your templates have been fully updated from Twig 1 to Twig 2 is the main preparation most modules and themes will need for Twig 3.
For example, the spaceless tag has been deprecated in Twig 2, in favour of a filter, and the tag has been removed in Twig 3:
Before:
{% spaceless %}
<div>
</div>
{% endspaceless %}
After:
{% apply spaceless %}
<div>
</div>
{% endapply %}
Additionally, support for the 'if' clause has been removed from for statements:
Before:
{% for i in 1..depth-1 if depth > 1 %}
<div>
{% endfor %}
{{ contents }}
{% for i in 1..depth-1 if depth > 1 %}
</div>
{% endfor %}
After:
{% if depth > 1 %}{% for i in 1..depth-1 %}
<div>
{% endfor %}{% endif %}
{{ contents }}
{% if depth > 1 %}{% for i in 1..depth-1 %}
</div>
{% endfor %}{% endif %}
Drush 11 required for Drupal 10
Drush 10 has a dependency that requires Twig 1 or Twig 2 so is incompatible with Drupal 10, making Drush 11 required.
Impacts:
Module developers
Themers









