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

These templates will go in core/modules/system/templates for now, pending #1905584: Move base theme system templates into /core/templates

#1757550: [Meta] Convert core theme functions to Twig templates
#1905584: Move base theme system templates into /core/templates

Comments

c4rl’s picture

Title: Replace all theme functions in theme.inc with Twig templates » Convert theme.inc to Twig

More general title. Updated summary.

c4rl’s picture

Just 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.

c4rl’s picture

c4rl’s picture

In 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.

c4rl’s picture

Assigned: jenlampton » Unassigned
c4rl’s picture

Based 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.

jenlampton’s picture

Yeah, 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.

c4rl’s picture

Ignore 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

jenlampton’s picture

Title: Convert theme.inc to Twig » [meta] Convert everything in theme.inc to Twig

Updating title to match new summary.

jenlampton’s picture

Issue summary: View changes

More descriptive summary

jenlampton’s picture

Issue summary: View changes

sub issue

star-szr’s picture

Issue summary: View changes

Adding more sub-issues

star-szr’s picture

Issue summary: View changes

Adding more sub-issues

star-szr’s picture

Created 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():

function drupal_common_theme() {
  return array(
  …
    'help' => array(
      'variables' => array(),
    ),
  …
  );
}

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?

star-szr’s picture

Issue summary: View changes

Add theme_datetime() issue

star-szr’s picture

Issue summary: View changes

Bullets

star-szr’s picture

Issue summary: View changes

Adding issue about where these templates will live eventually

c4rl’s picture

@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.

c4rl’s picture

Issue summary: View changes

Add instructions as to where the templates go

star-szr’s picture

Issue summary: View changes

Add note about how the sandbox relates to these issues.

star-szr’s picture

Issue summary: View changes

Add more about theme functions not yet converted in the sandbox

star-szr’s picture

Thanks 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.

star-szr’s picture

And I did a bit of detective work about #10 and created an issue to remove that:

#1961886: Remove 'help' definition from drupal_common_theme()

star-szr’s picture

Issue summary: View changes

Adding active issues for converting region, page, html templates

star-szr’s picture

Issue summary: View changes

Add postponed theme_link() issue.

jenlampton’s picture

Issue summary: View changes

line

c4rl’s picture

Issue summary: View changes

Updated issue summary.

star-szr’s picture

Issue summary: View changes

Fixing li tag

jenlampton’s picture

Issue summary: View changes

update

jenlampton’s picture

Status: Active » Closed (duplicate)

Closing now as a dupe of #1757550: [Meta] Convert core theme functions to Twig templates
since that one seems to be better organized :)

jenlampton’s picture

Issue summary: View changes

update