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.
Task
Use Twig instead of PHPTemplate
Remaining
- Replace all theme functions and templates with .html.twig equivalent templates
- Add new preprocess functions for the .html.twig equivalent templates
- Update all hook_theme definitions
Related
Comment | File | Size | Author |
---|---|---|---|
#24 | interdiff.txt | 4.16 KB | shanethehat |
#24 | twig-link-1961876-23.patch | 5.54 KB | shanethehat |
#19 | interdiff.txt | 1.63 KB | shanethehat |
#19 | twig-link-1961876-19.patch | 5.62 KB | shanethehat |
#17 | twig-link-1961876-17.patch | 4.14 KB | shanethehat |
Comments
Comment #1
star-szrOops, status.
Comment #2
star-szrAs discussed on IRC, let's pick this back up again, rolling a patch combined with #1922454: Gut l(), fix theme('link'), have a working framework for consistently generated links inside and outside of Twig so this is ready to go.
Comment #3
joelpittetFirst crack at this one. I didn't take much except most the docs from the sandbox. Hopefully that is ok. I used spaceless because of it's fancy little trick where it negates the newline at the end of the file and causes the tests to pass.
Could use some manual testing and review in general.
Comment #4
joelpittetComment #6
joelpittetOk seeing as that failed, I rolled the same patch above with #1922454: Gut l(), fix theme('link'), have a working framework for consistently generated links inside and outside of Twig to see how it fairs.
Comment #7
joelpittetThe interdiff on this is a bit silly (because it's #1922454: Gut l(), fix theme('link'), have a working framework for consistently generated links inside and outside of Twig). But this comment has a patch attached... oOooo, ahhhh!
Comment #9
joelpittetTweaks but still fails on active link because it's not using l(), maybe I should move some of that logic to theme_link?
Comment #11
joelpittetRe-roll again with #1922454: Gut l(), fix theme('link'), have a working framework for consistently generated links inside and outside of Twig, more guts in preprocess
Comment #12
star-szrGreen!
Comment #13
tlattimore CreditAttribution: tlattimore commentedThis is looking really good to. Manual tested:
Before Twig:
<a href="/node" class="custom-class" id="unique-id">Custom link</a>
After Twig:
<a href="/node" class="custom-class" id="unique-id">Custom link</a>
Comment #14
c4rl CreditAttribution: c4rl commentedComment #15
thedavidmeister CreditAttribution: thedavidmeister commentedLooks good, but surely postponed on the patch it incorporates being committed first.
Comment #16
star-szrThis will need a reroll now that #1922454: Gut l(), fix theme('link'), have a working framework for consistently generated links inside and outside of Twig is in!
Comment #17
shanethehat CreditAttribution: shanethehat commentedRerolled
Comment #19
shanethehat CreditAttribution: shanethehat commentedoops, somehow missed a whole function
Comment #21
shanethehat CreditAttribution: shanethehat commented#19: twig-link-1961876-19.patch queued for re-testing.
Tests pass locally, I suspect random failure.
Comment #22
thedavidmeister CreditAttribution: thedavidmeister commented@shanethehat - please don't use url_is_active() and please do statically cache the function calls used to detect the link's active status and please do optimise the logic of the active checks to stop comparing variables once we know there's no match.
see comments #106 through to #122 at #1922454: Gut l(), fix theme('link'), have a working framework for consistently generated links inside and outside of Twig for an explanation of all of this :)
Comment #23
thedavidmeister CreditAttribution: thedavidmeister commentedRelated #1985974: Make l() optionally return structured output
Comment #24
shanethehat CreditAttribution: shanethehat commentedAs discussed on IRC, this is essentially a copy/paste of the part of l() that handles the determination of 'active'. It's an unpleasant duplication that should be resolved by #1985974: Make l() optionally return structured output
Comment #25
thedavidmeister CreditAttribution: thedavidmeister commentedRelevant #1985470: Remove theme_link()
Comment #26
thedavidmeister CreditAttribution: thedavidmeister commentedTheme link was removed, there's nothing to convert any more.
Comment #26.0
thedavidmeister CreditAttribution: thedavidmeister commentedUpdate summary