Free Drupal Training and UX support

October 11th, 2012 § 0 comments

http://ddcla.org/2012/sessions/new-theme-layer-drupal-8

 

A NEW THEME LAYER FOR DRUPAL 8

 

We will be introducing Twig into Drupal 8. Twig is a new theme engine created by the creator of Symfony.

All theme functions in core will be replaced by twig template files, meaning that for someone who needs to adjust markup – there will be only one way to do it: override a template file (not a theme function).

While we’re creating a bunch of “new” template files, we’ll get a chance to review all the markup that comes out of core, and restructure the use of these templates to be more consistent. For example, we’ll be able to provide one “wrapper” template that can be used everywhere, rather than each module creating it’s own, or adding its own wrapper around it’s special markup.

Twig can flatten & sanitize all at the time of printing, meaning we can remove the whole “process” layer that exists in Drupal 7.

Much still needs to be decided about when the template gets called, since in twig-land the template should be called first, and what slides into that template is determined by the ‘variables’ that are printed within it. This is the opposite of how things are currently rendered in drupal-land.

Our pre-process layer may actually become a post-process layer, since the template gets called first, and if a ‘variable’ is requested that Twig doesn’t know about yet, it will need to search the pre-process layer for what to print, and how it should be converted into HTML.

Twig will have it’s own way of rendering objects such as nodes, comments, and users, so we should be able to remove (or replace) the whole “render” layer in the theme (keeping it of course, for things like forms).

Let’s discuss!

 

Interesting session

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

What's this?

You are currently reading Free Drupal Training and UX support at Usability @ UCLA Library.

meta