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
We need to update all the theme functions in theme.inc so that they are instead Twig template files. This can be broken down into several smaller issues for the convenience of patching core, with the most important coming first, and the rest later. So far, sub-issues include:
Proposed resolution
- Replace all theme functions with .html.twig equivalent templates
- Add new preprocess functions for the .html.twig equivalent templates
- Update all hook_theme definitions
Remaining
- #1939008: Convert theme_table() to Twig Assigned to: sun
- #1939062: Convert theme_item_list() to Twig
- #1939064: Convert theme_links() to Twig
- #1939066: Convert theme_breadcrumb() to Twig
- #1939068: Convert theme_image() to Twig
- #1961876: Convert theme_link() to Twig
- #1939080: Convert theme_datetime() to Twig
- #1939082: Convert theme_status_messages() to Twig
- #1939086: Convert theme_dropbutton_wrapper() to Twig Assigned to: catch
- #1939088: Convert theme_meter() to Twig
- #1939090: Convert theme_tablesort_indicator() to Twig
- #1939092: Convert theme_mark() to Twig
- #1939094: Convert theme_more_help_link() to Twig
- #1939096: Convert theme_feed_icon() to Twig
- #1939098: Convert theme_more_link() to Twig
- #1939100: Convert theme_progress_bar() to Twig
- #1939102: Convert theme_indentation() to Twig
- #1939104: Convert theme_html_tag() to Twig
These templates will go in core/modules/system/templates for now, pending #1905584: Move base theme system templates into /core/templates
Related
#1757550: [Meta] Convert core theme functions to Twig templates
#1905584: Move base theme system templates into /core/templates
Comments
Comment #1
c4rl CreditAttribution: c4rl commentedMore general title. Updated summary.
Comment #2
c4rl CreditAttribution: c4rl commentedJust an FYI here, I'm making some updates to the Twig sandbox that affect theme.inc, review the git logs from today or ping me in IRC if you have questions.
Comment #3
c4rl CreditAttribution: c4rl commentedAlso, this issue may have some big implications #1778610: Remove the check for a link template from l(), have l() always output just a string.
Comment #4
c4rl CreditAttribution: c4rl commentedIn the sandbox, I moved link.html.twig to link-default.html.twig because if it exists, it will turn on $use_theme in l() in common.inc. That feels like a hack to me, but we should follow-up in that other issue.
Comment #5
c4rl CreditAttribution: c4rl commentedComment #6
c4rl CreditAttribution: c4rl commentedBased on #1905584: Move base theme system templates into /core/templates it seems this issue would be accommodated by #1898454: system.module - Convert PHPTemplate templates to Twig, though that may result in a large patch.
Comment #7
jenlamptonYeah, this should really become a meta issue of several smaller patches. Some need to be done sooner rather than later. item_list and table for sure need to be done sooner. We should also figure out what some of the other more-used functions from theme.inc are and do those as well.
Comment #8
c4rl CreditAttribution: c4rl commentedIgnore what I said about system.module in #6, we'll proceed to convert this separately of system.module and put in /core/templates as described in #1905584: Move base theme system templates into /core/templates
Comment #9
jenlamptonUpdating title to match new summary.
Comment #9.0
jenlamptonMore descriptive summary
Comment #9.1
jenlamptonsub issue
Comment #9.2
star-szrAdding more sub-issues
Comment #9.3
star-szrAdding more sub-issues
Comment #10
star-szrCreated sub-issues for the relevant theme functions, and added notes about the ones I didn't create issues for.
I can't make heads or tails of this in
drupal_common_theme()
:There's no theme_help() and of course no help.tpl.php, so what is this doing, and is it something we need to convert to Twig?
Comment #10.0
star-szrAdd theme_datetime() issue
Comment #10.1
star-szrBullets
Comment #10.2
star-szrAdding issue about where these templates will live eventually
Comment #11
c4rl CreditAttribution: c4rl commented@Cottser #10 We're bound to find some odds & ends cleaning out the attic. This seems like a good example. If we can't find a implementation/callback, let's remove it as part of the conversion.
Comment #11.0
c4rl CreditAttribution: c4rl commentedAdd instructions as to where the templates go
Comment #11.1
star-szrAdd note about how the sandbox relates to these issues.
Comment #11.2
star-szrAdd more about theme functions not yet converted in the sandbox
Comment #12
star-szrThanks to everyone who's worked on these issues!
I just created issues for region.tpl.php, page.tpl.php, and html.tpl.php, those are up for grabs now :)
I also created a postponed issue for theme_link(), I think we'll need to do something there after #1922454: Gut l(), fix theme('link'), have a working framework for consistently generated links inside and outside of Twig is resolved.
Comment #13
star-szrAnd I did a bit of detective work about #10 and created an issue to remove that:
#1961886: Remove 'help' definition from drupal_common_theme()
Comment #13.0
star-szrAdding active issues for converting region, page, html templates
Comment #13.1
star-szrAdd postponed theme_link() issue.
Comment #13.2
jenlamptonline
Comment #13.3
c4rl CreditAttribution: c4rl commentedUpdated issue summary.
Comment #13.4
star-szrFixing li tag
Comment #13.5
jenlamptonupdate
Comment #14
jenlamptonClosing now as a dupe of #1757550: [Meta] Convert core theme functions to Twig templates
since that one seems to be better organized :)
Comment #14.0
jenlamptonupdate