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
#1885560: [meta] Convert everything in theme.inc to Twig
#1843668: Move building of breadcrumb render array from template_process_page() to template_preprocess_page()
#1843650: Remove the process layer (hook_process and hook_process_HOOK)
Comment | File | Size | Author |
---|---|---|---|
#31 | interdiff.txt | 545 bytes | chrisjlee |
#31 | 1939066-31.patch | 2.2 KB | chrisjlee |
#28 | twig-breadcrumb_conversion-1939068-28.patch | 2.2 KB | jenlampton |
#25 | 1939068-25-twig-breadcrumb-theme.patch | 2.2 KB | joelpittet |
#14 | 1939068-twig-theme-image-Reroll-6-comment-14.patch | 2.21 KB | chrisjlee |
Comments
Comment #1
star-szrComment #2
star-szrInitial patch.
Comment #3
msmithcti CreditAttribution: msmithcti commentedIt looks like since #1687864: Bring theme_breadcrumb() up to WCAG 2.0 AA the separator is added in system.theme.css using a :before pseduo element. This means that when there's more than two items in the list, the separator is shown twice. Here's a patch that fixes that (and simplifies the template in the process).
Other than that, it looks great!
Comment #4
star-szrNice, thanks @splatio!
Comment #5
tlattimore CreditAttribution: tlattimore commentedThe patch from #3 looks good to me. Great catch with the WCAG 2.0 change to this, Splatio.
Great work here guys!
Comment #6
joelpittetI removed the
is defined
wondering your thoughts on this? It's easy to see on the seven theme home page where there is an empty breadcrumbs ol:Otherwise some light cleanup: removed the 'array' wording from the twig docblock and tabbed in the if statement to follow twig coding standards.
Comment #7
jenlamptonLooks great!
Comment #8
nikkubhai CreditAttribution: nikkubhai commented#6: breadcrumb-twig-1939066-6.patch queued for re-testing.
Comment #10
star-szr#6: breadcrumb-twig-1939066-6.patch queued for re-testing.
Comment #11
star-szrBack to RTBC based on #7, I highly suspect random test failures since the tests (still) passed locally.
Comment #12
star-szrThis will need a quick reroll now that #1961886: Remove 'help' definition from drupal_common_theme() is in.
Comment #13
star-szrComment #14
chrisjlee CreditAttribution: chrisjlee commentedReroll attempt
Comment #15
star-szrThanks @chrisjlee, back to RTBC!
Comment #16
star-szrTags.
Comment #17
alexpottComment #18
joelpittetFYI, this one is a bit tricky to profile because the XHProf-kit expects to profile the homepage and breadcrumbs don't show on the homepage.
Changing this line temporarily should do the trick... I'll let you know :)
https://github.com/LionsAd/xhprof-kit/blob/master/find-min-web.sh#L8
Comment #19
joelpittetSo yeah that worked from #18
Scenario
Node 1 was a child of node 2 which was a child of node 3
Home > Node 3 > Node 2
Profiled /node/1
Run 1
http://www.lionsad.de/xhprof-kit/xhprof/xhprof_html/?run1=51afe7feeb64d&...
http://www.lionsad.de/xhprof-kit/xhprof/xhprof_html/?run1=51afe7feeb64d&...
Run 2
http://www.lionsad.de/xhprof-kit/xhprof/xhprof_html/?run1=51afe9a0d59b4&...
http://www.lionsad.de/xhprof-kit/xhprof/xhprof_html/?run1=51afe9a0d59b4&...
Comment #20
star-szr#14: 1939068-twig-theme-image-Reroll-6-comment-14.patch queued for re-testing.
Comment #20.0
star-szrRemove sandbox link
Comment #21
klonos...coming from #1843668: Move building of breadcrumb render array from template_process_page() to template_preprocess_page():
That one was marked as a duplicate in favor of this one here, but I don't speak twig yet so I don't know if the solution offered here will also cover the problem mentioned in the other issue. Anyone care to elaborate?
Comment #22
jenlamptonAfter discussing with @joelpittet, this issue is now just blocking #1843668: Move building of breadcrumb render array from template_process_page() to template_preprocess_page()
(not a dupe)
Comment #23
joelpittet@klonos thanks for the pointer. They are duping code with the twig, it's just this it the twig conversion, that one does some other useful bits:)
We can just remove the twig parts from the #1843668: Move building of breadcrumb render array from template_process_page() to template_preprocess_page() once this one gets.
Comment #24
alexpottNeeds a reroll
Comment #25
joelpittetRe-roll #14
Comment #27
jenlampton#25: 1939068-25-twig-breadcrumb-theme.patch queued for re-testing.
Comment #28
jenlamptontried to re-roll again, just for giggles.
Comment #28.0
jenlampton...adding #1843668 to the "Related" section.
Comment #29
Fabianx CreditAttribution: Fabianx commentedThis was just re-rolled. Still looks good to me, back to RTBC.
Comment #30
alexpottThe class has changed to become "visually-hidden" see #1363112: Simplify names of "element-x" helper classes
Comment #31
chrisjlee CreditAttribution: chrisjlee commentedhad five minutes. easy class change. enjoy.
Comment #32
Fabianx CreditAttribution: Fabianx commentedBack to RTBC then
Comment #33
alexpottCommitted 2c67e90 and pushed to 8.x. Thanks!
Comment #34.0
(not verified) CreditAttribution: commentedrelated