Twig spaceless filter is deprecated

Created on 3 October 2024, 6 months ago

Problem/Motivation

Split from ✨ Drupal 11 compatibility fixes for webform Active

πŸ“Œ Task
Status

Active

Version

6.3

Component

Code

Created by

πŸ‡¦πŸ‡ΊAustralia acbramley

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

Merge Requests

Comments & Activities

  • Issue created by @acbramley
  • Merge request !523Resolve #3478399 "Twig spaceless filter" β†’ (Open) created by acbramley
  • Pipeline finished with Failed
    6 months ago
    Total: 2017s
    #299473
  • Pipeline finished with Failed
    6 months ago
    Total: 827s
    #299489
  • Pipeline finished with Failed
    6 months ago
    Total: 663s
    #299506
  • πŸ‡¦πŸ‡ΊAustralia acbramley
  • Pipeline finished with Failed
    6 months ago
    Total: 774s
    #299518
  • πŸ‡¦πŸ‡ΊAustralia acbramley

    This can be rebased once πŸ› Fix Optional parameter X declared before required parameter Y Active and πŸ“Œ Enable concurrent phpunit Active are in.

  • Pipeline finished with Success
    6 months ago
    Total: 584s
    #299524
  • πŸ‡ΊπŸ‡ΈUnited States jrockowitz Brooklyn, NY

    We shouldn't remove the spaceless behavior from computed fields because we need to the get the computed values without spaces.

    We should refactor computed twig examples to use https://twig.symfony.com/doc/3.x/templates.html#whitespace-control

  • πŸ‡¦πŸ‡ΊAustralia acbramley

    @jrockowitz what are the computed fields you're referring to?

  • Pipeline finished with Success
    6 months ago
    Total: 2108s
    #300339
  • πŸ‡ΊπŸ‡ΈUnited States nicxvan

    I think @jrockowitz means: tests/modules/webform_test/config/install/webform.webform.test_element_computed_ajax.yml

    Tests are not failing and that is a test structure so I'm not sure what the concern is, but I can take a crack at add - to remove spaces instead.

  • πŸ‡ΊπŸ‡ΈUnited States nicxvan

    I think that should do it, I'll watch the tests.

    I think we can probably just remove it from the two templates (progress and help element)

    Let me know.

    The test ajax should now be equivalent.

  • Pipeline finished with Failed
    6 months ago
    Total: 2012s
    #300933
  • πŸ‡ΊπŸ‡ΈUnited States nicxvan

    That made the tests very unhappy

  • πŸ‡¨πŸ‡¦Canada Liam Morland Ontario, CA πŸ‡¨πŸ‡¦

    This can wait until the core issue is resolved. The spaceless filter is still used in Drupal 11. We can wait and see what approach core takes to this.

  • πŸ‡¦πŸ‡ΊAustralia acbramley

    My changes were following what core was doing, we don't need to strip newlines between html tags for the most part. The test changes are necessary unless we hugely refactor them as well which should be done eventually but isn't required since we can just regex instead

  • πŸ‡ΊπŸ‡ΈUnited States nicxvan

    I'll revert my changes early next week when I'm back if someone doesn't get to it before me.

  • πŸ‡ΊπŸ‡ΈUnited States jrockowitz Brooklyn, NY

    The code I am concerned about is https://git.drupalcode.org/project/webform/-/blob/6.3.x/src/Element/Webf....

    In theory, we could implement spaceless via code, which would remove all the space between HTML tags after the value is computed.

  • πŸ‡ΊπŸ‡ΈUnited States nicxvan

    Ok I reverted my change.

    @jrockowitz I see now, I was confused cause I mistakenly thought @acbramley had replaced all spaceless calls and tests were passing. I will take a look at implementing spaceless there, there is no direct replacement.

    Do you want me to look up the regex that spaceless uses and implement that here?

    Is there another simpler solution that will work for computed?

  • Pipeline finished with Success
    6 months ago
    Total: 1765s
    #302453
  • Pipeline finished with Failed
    3 months ago
    Total: 724s
    #390802
  • Pipeline finished with Success
    3 months ago
    Total: 793s
    #394574
  • Pipeline finished with Success
    3 months ago
    Total: 660s
    #394597
  • Pipeline finished with Canceled
    3 months ago
    Total: 73s
    #397780
  • Pipeline finished with Failed
    3 months ago
    Total: 656s
    #397781
  • Pipeline finished with Failed
    3 months ago
    Total: 976s
    #397949
  • Pipeline finished with Failed
    3 months ago
    Total: 778s
    #401532
  • Pipeline finished with Failed
    3 months ago
    Total: 690s
    #401594
  • Pipeline finished with Failed
    3 months ago
    Total: 1290s
    #401713
  • Pipeline finished with Failed
    3 months ago
    Total: 1023s
    #401804
  • Pipeline finished with Failed
    2 months ago
    Total: 853s
    #403612
  • Pipeline finished with Failed
    2 months ago
    Total: 314s
    #403876
  • Pipeline finished with Success
    2 months ago
    Total: 841s
    #403882
  • Pipeline finished with Success
    2 months ago
    Total: 904s
    #403917
  • Pipeline finished with Failed
    2 months ago
    Total: 985s
    #407060
  • Pipeline finished with Failed
    2 months ago
    Total: 987s
    #407095
  • Pipeline finished with Failed
    2 months ago
    Total: 970s
    #407153
  • Pipeline finished with Failed
    2 months ago
    Total: 990s
    #407228
  • Pipeline finished with Success
    2 months ago
    Total: 858s
    #408102
  • Pipeline finished with Failed
    about 1 month ago
    Total: 626s
    #440990
  • Pipeline finished with Success
    about 1 month ago
    Total: 847s
    #441044
  • Pipeline finished with Success
    6 days ago
    Total: 332s
    #462352
Production build 0.71.5 2024