Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 295116

[META-64] Convert core theme functions to Twig templates

$
0
0

Problem/Motivation

Now that the Twig engine is in core, we must convert all existing core *.tpl.php template files andtheme_ functions to use Twig templates. Preprocess functions and hook_theme definitions must also be updated.

TODO

DOCS: Coding standards for conversion:

Resources

Proposed resolution

See sub-issues below.

Remaining tasks

Template file conversions:

  • Replace all tpl.php files with .html.twig equivalents
  • Update preprocess functions for the .html.twig versions of .tpl.php templates, to use renderables
  • Benchmark the .html.twig versions of template files to assure they aren't very much slower

Convert theme_* functions to Twig templates.

  • Replace all theme functions with .html.twig equivalent templates
  • Add new preprocess functions for the .html.twig versions of theme functions (if necessary)
  • Benchmark the .html.twig versions of theme functions to assure they aren't very much slower
  • Update all hook_theme definitions to include 'template' => 'foo', where foo.html.twig is the template being added

The total count of remaining (not including test functions or theme overrides) theme functions in core is displayed in the issue title. This search can be run in ack 2.x to get the current number:

ack 'function theme_[^(]+\([^$]*(\$variables)*\) ?{' -h -c --ignore-dir=core/modules/system/tests core

Remove the -c to get a list of remaining theme functions. Not all these theme functions will end up as Twig templates but our goal is to be rid of all them for 8.0.0.

RTBC

Needs review

@see Documentation for reviewing patches

Needs profiling

@see Documentation for profiling twig patches

Needs manual testing

@see Documentation for manually testing twig patches

Needs work

Twig + Needs reroll search

Needs work (needs Tests)

@see Documentation for writing automated tests

Needs work (performance tuning)

Sub Metas

Postponed

Fixed/closed (roughly reverse chronological)


User interface changes

None.

API changes

Likely minimal to no API changes.

Possible new theme layer process order:
http://gist.io/5650535

Resources

Google Docs:

Twig sandbox: http://drupal.org/sandbox/pixelmord/1750250 (all conversions have been moved over from the sandbox and we are working directly in the core queue, the sandbox link is only here for reference).

Related Issues

### These issues were actually blocking progress ###

## This issue will decrease the work we need to do ##

These issues are related to our work, and will block the release of D8

Twig engine issues

Performance issues

After Commit Issues

Notes for reviewing Twig Patches manually

To find a list of patches that are theoretically good to go but manual testing is holding them back see http://drupal.org/project/issues/search/drupal?text=convert&status%5B%5D....

It is helpful to use Dreditor to review patches and to test patches applied to fresh install of Drupal8 via simplytest.me.

Generally, you are trying to see if the HTML output has changed from a clean install of Drupal 8 versus a patched install. Many Twig issues have a "To test this code" section in the issue summary that will direct you how to test the patch. If you find that testing the patch using simplytest.me has not produced the results you expected, or only some of the expected output, you will want to test the patch manually.

Check out this screencast on how to use Daisy Diff to compare markup:http://www.youtube.com/watch?v=Bv4PY_ZEP4Q


Viewing all articles
Browse latest Browse all 295116

Trending Articles