At the New York City Drupal Camp on July 21 & July 22 chx, c4rl, mlncn, ethanw, msonnabaum, tlattimore, moshe weitzman, quicksketch, and jenlampton sprinted on creating a new theme layer for Drupal 8, using Twig.
We started the sprint with an adjustment of expectations.
Our initial plan for getting twig into core started with a patch that would replace the theming of a comment with twig. This proved to be problematic because of how many parts of Drupal that would need to be changed to achieve this seemingly simple task of theming a "comment".
When we started the theme sprint in NYC we changed directions for our first core patch. We decided to start small, and continue down the path taking smaller steps along the way.
Our new first patch will update the Sark core theme to use Twig. This should be a very simple operation since the stark theme does not contain any template files or theme overrides. To prove that Twig is actually working, we will also include an example of one twig template file (region) that is replaced with a twig template, and one theme function (item list) that is now replaced with a twig template.
This will serve as an example of how the theme system in core can be replaced - one piece at a time - with twig templates. We were able to create this first patch very quickly, and then moved on to our second patch. See http://drupal.org/node/1696786
The second patch will will update the Bartik core theme to use Twig. This will involve replacing all the template files in Bartik with Twig equivalents, and all the theme function overrides with Twig templates as well.
As we started on this task, we began to run into some issues. Mainly that the show, hide, and render functions were called directly from within template files, and in order to replace these with Twig templates, we had to work out a temporary solution that would keep Drupal running while slowly working through core to swap out PHPTemplate files for Twig templates.
Since "how to rip out and replace render()" was one of the big questions that prevented us from proceeding with our first approach to getting Twig in core, we decided to postpone coming up with a suitable solution until a later date, and focus on making some progress with the directions we have decided on already. This means that render and Twig templates need to work in harmony - at least for a little while - so we can keep moving forward on template replacements.
We exposed all the PHP functions usually called from within template files (hide, show, render, check_plain, t, etc) to twig, enabling us to update the template files to use twig syntax, and not loose much of the functionality that exists currently.
This allowed us to continue with the replacement of template files in Bartik, so that we could put forward our second core patch.
Also at the NYC Drupal Camp Theme Sprint, we reviewed, benchmarked, and made some more progress on the attributes patch (see http://drupal.org/node/1290694#comment-6307512) which has been committed!
All in all, a very successful sprint. There's LOTS more to do, if you'd like to help please contact me and we'll be happy to put you to work!