Problem/Motivation
spaceless tag has been removed in Twig 3. It is not used in Drupal 9 anymore.
Proposed resolution
Use spaceless filter instead in Drupal 8 too to help new sites become compatible with Twig 3 / Drupal 10.
https://twig.symfony.com/doc/3.x/filters/spaceless.html
Before:
{% spaceless %}
{% endspaceless %}
After:
{% apply spaceless %}
{% endapply %}
Remaining tasks
Create a patch.
User interface changes
None.
| Comment | File | Size | Author |
|---|---|---|---|
| #12 | flag-remove_usage_of_spaceless_tag_in_twig_templates-12.patch | 1.1 KB | rudi teschner |
| #11 | 3456584-remove-usage-of-12.patch | 613 bytes | karangarske |
| #5 | Remove-usage-of-spaceless-tag-in-Twig-templates-3456584.patch | 0 bytes | niharika.s |
Issue fork flag-3456584
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
saidatomComment #3
malcomio commentedShould this have been closed as outdated?
There's still a
spacelesstag in https://git.drupalcode.org/project/flag/-/blob/8.x-4.x/templates/flag.ht..., and a scan with Upgrade Status reports incompatibility with Drupal 11 in themes that have templates based on it.See also #3443224: Spaceless Tag Issue and #3477375: Provide non-deprecated replacement for Twig "spaceless" filter
Comment #4
berdirThat's a new deprecation, its actually the new syntax proposed here.
I think a new issue makes more sense
Comment #5
niharika.s commentedI have applied all the changes.
Comment #6
niharika.s commentedComment #7
ivnish@niharika.s your patch is empty
Comment #10
shivam_tiwari commentedComment #11
karangarske commentedcreated patch file for this. file goes in root/patches. this would be my first patch file. i tested it and patch worked. on drupal 10.4
Comment #12
rudi teschner commentedMissed one occurrence of spaceless in submodule that was pointed out as warning in upgrade status module.
File: modules/contrib/flag/modules/flag_count/templates/flag-count.html.twig
Line: 14
Warning: Since twig/twig 3.12: Twig Filter "spaceless" is deprecated. See https://drupal.org/node/3071078.
File: modules/contrib/flag/templates/flag.html.twig
Line: 17
Warning: Since twig/twig 3.12: Twig Filter "spaceless" is deprecated. See https://drupal.org/node/3071078.
Comment #13
shivam_tiwari commented@rudi teschner Thanks for informing. I updated MR also related to it.
Comment #15
ivnish