A new theme layer for Drupal 8? · Drupal 8 Theme layer image by John Albin Wilkins Monday, August...

41
with jenlampton, chx, JohnAlbin, mortendk, effulgentsia, EclipseGc, & davidneedham 22 August 2012 A new theme layer for Drupal 8? Monday, August 27, 2012

Transcript of A new theme layer for Drupal 8? · Drupal 8 Theme layer image by John Albin Wilkins Monday, August...

Page 1: A new theme layer for Drupal 8? · Drupal 8 Theme layer image by John Albin Wilkins Monday, August 27, 2012. Created Date: 8/27/2012 8:50:06 PM ...

with  jenlampton,  chx,  JohnAlbin,  mortendk,  effulgentsia,  EclipseGc,  &  davidneedham

22 August 2012

A new theme layer for Drupal 8?

Monday, August 27, 2012

Page 2: A new theme layer for Drupal 8? · Drupal 8 Theme layer image by John Albin Wilkins Monday, August 27, 2012. Created Date: 8/27/2012 8:50:06 PM ...

INTRODUCTIONS

Monday, August 27, 2012

Page 3: A new theme layer for Drupal 8? · Drupal 8 Theme layer image by John Albin Wilkins Monday, August 27, 2012. Created Date: 8/27/2012 8:50:06 PM ...

WHO ARE YOU?

Monday, August 27, 2012

Page 4: A new theme layer for Drupal 8? · Drupal 8 Theme layer image by John Albin Wilkins Monday, August 27, 2012. Created Date: 8/27/2012 8:50:06 PM ...

YOU ARE:

Theme developers?(D7? D6? D5?)

Monday, August 27, 2012

Page 5: A new theme layer for Drupal 8? · Drupal 8 Theme layer image by John Albin Wilkins Monday, August 27, 2012. Created Date: 8/27/2012 8:50:06 PM ...

YOU ARE:

Theme developers?(D7? D6? D5?)

New to Drupal?(just want to know what the heck is going on in D8)

Monday, August 27, 2012

Page 6: A new theme layer for Drupal 8? · Drupal 8 Theme layer image by John Albin Wilkins Monday, August 27, 2012. Created Date: 8/27/2012 8:50:06 PM ...

YOU ARE:

Theme developers?(D7? D6? D5?)

New to Drupal?(just want to know what the heck is going on in D8)

Drupal Experts?(also want to know what the heck is going on in D8)

Monday, August 27, 2012

Page 7: A new theme layer for Drupal 8? · Drupal 8 Theme layer image by John Albin Wilkins Monday, August 27, 2012. Created Date: 8/27/2012 8:50:06 PM ...

DRUPAL 8 :A NEW THEME LAYER

(probably)

Monday, August 27, 2012

Page 8: A new theme layer for Drupal 8? · Drupal 8 Theme layer image by John Albin Wilkins Monday, August 27, 2012. Created Date: 8/27/2012 8:50:06 PM ...

A modern template engine for PHP.

TWIG

http://twig.sensiolabs.org

Monday, August 27, 2012

Page 9: A new theme layer for Drupal 8? · Drupal 8 Theme layer image by John Albin Wilkins Monday, August 27, 2012. Created Date: 8/27/2012 8:50:06 PM ...

TWIG

• well documented• extensible• secure• well tested• IDE integration• recognizable syntax

• Python (django)• JS (TwigJS)•Ruby (Liquid)

•by Symfony’s author, Fabien Potencier

Monday, August 27, 2012

Page 10: A new theme layer for Drupal 8? · Drupal 8 Theme layer image by John Albin Wilkins Monday, August 27, 2012. Created Date: 8/27/2012 8:50:06 PM ...

TECHNICAL DIFFICULTIESWITH CONVERTING TO TWIG

(chx)

•Replacing (most of) render•What’s the first patch (a “working example”)•Removing “layers” (process, preprocess)•Fitting in with the ‘blocks everywhere’ initiative?• ?

Monday, August 27, 2012

Page 11: A new theme layer for Drupal 8? · Drupal 8 Theme layer image by John Albin Wilkins Monday, August 27, 2012. Created Date: 8/27/2012 8:50:06 PM ...

WHY TWIG?

Monday, August 27, 2012

Page 12: A new theme layer for Drupal 8? · Drupal 8 Theme layer image by John Albin Wilkins Monday, August 27, 2012. Created Date: 8/27/2012 8:50:06 PM ...

 

CURRENT

Drupal only (weird) syntax

Monday, August 27, 2012

Page 13: A new theme layer for Drupal 8? · Drupal 8 Theme layer image by John Albin Wilkins Monday, August 27, 2012. Created Date: 8/27/2012 8:50:06 PM ...

 

CURRENT

Object or Array?

Monday, August 27, 2012

Page 14: A new theme layer for Drupal 8? · Drupal 8 Theme layer image by John Albin Wilkins Monday, August 27, 2012. Created Date: 8/27/2012 8:50:06 PM ...

 

print or print render() ?

CURRENT

Monday, August 27, 2012

Page 15: A new theme layer for Drupal 8? · Drupal 8 Theme layer image by John Albin Wilkins Monday, August 27, 2012. Created Date: 8/27/2012 8:50:06 PM ...

 

PHP is insecure

CURRENT

Monday, August 27, 2012

Page 16: A new theme layer for Drupal 8? · Drupal 8 Theme layer image by John Albin Wilkins Monday, August 27, 2012. Created Date: 8/27/2012 8:50:06 PM ...

 

Too many template files

CURRENT

Monday, August 27, 2012

Page 17: A new theme layer for Drupal 8? · Drupal 8 Theme layer image by John Albin Wilkins Monday, August 27, 2012. Created Date: 8/27/2012 8:50:06 PM ...

 

complex mix of subsystems

CURRENT

Monday, August 27, 2012

Page 18: A new theme layer for Drupal 8? · Drupal 8 Theme layer image by John Albin Wilkins Monday, August 27, 2012. Created Date: 8/27/2012 8:50:06 PM ...

Requested by theme developers:•The ability to easily add/change/remove markup•Consistency in data presented to the theme layer•Sensible markup defaults / common patterns

Requested by developers:•A more secure theme layer•A more performant theme layer

(see http://bit.ly/P8ZR65)

WHAT DO WE WANT IN D8?

Monday, August 27, 2012

Page 19: A new theme layer for Drupal 8? · Drupal 8 Theme layer image by John Albin Wilkins Monday, August 27, 2012. Created Date: 8/27/2012 8:50:06 PM ...

WHAT DO WE WANT IN D8?

Other stuff?

Monday, August 27, 2012

Page 20: A new theme layer for Drupal 8? · Drupal 8 Theme layer image by John Albin Wilkins Monday, August 27, 2012. Created Date: 8/27/2012 8:50:06 PM ...

HOW WILL TWIG HELP?

(JohnAlbin’s new diagram goes here)

Monday, August 27, 2012

Page 21: A new theme layer for Drupal 8? · Drupal 8 Theme layer image by John Albin Wilkins Monday, August 27, 2012. Created Date: 8/27/2012 8:50:06 PM ...

Requested by theme developers: •The ability to easily add/change/remove markup

? template files only instead of also theme functions? cleaner syntax {} {{}} {# #} {% %}• Consistency in data presented to the theme layer

? Data always presented as “drillable”* objects•Sensible markup defaults / common patterns

? We’ll have to replace it all anyway.

SO, HOW WILL TWIG HELP?

* we don’t know exactly how we are going to do this yet

Monday, August 27, 2012

Page 22: A new theme layer for Drupal 8? · Drupal 8 Theme layer image by John Albin Wilkins Monday, August 27, 2012. Created Date: 8/27/2012 8:50:06 PM ...

Requested by developers:•A more secure theme layer

+ Auto-escaping makes templates secure•A more performant theme layer

+ Compiled PHP classes should* perform better

HOW WILL TWIG HELP?

* we won’t know for sure until we replace everything.

Monday, August 27, 2012

Page 23: A new theme layer for Drupal 8? · Drupal 8 Theme layer image by John Albin Wilkins Monday, August 27, 2012. Created Date: 8/27/2012 8:50:06 PM ...

HOW WILL TWIG HELP?

Other stuff?

Monday, August 27, 2012

Page 24: A new theme layer for Drupal 8? · Drupal 8 Theme layer image by John Albin Wilkins Monday, August 27, 2012. Created Date: 8/27/2012 8:50:06 PM ...

WHAT ABOUT THE TOOLS WE ALREADY HAVE?

Do you like:•do you like template file overrides?•do you like theme function overrides?•do you love preprocess functions?•do you use hooks in your theme?•do you use _alter() hooks?

Monday, August 27, 2012

Page 25: A new theme layer for Drupal 8? · Drupal 8 Theme layer image by John Albin Wilkins Monday, August 27, 2012. Created Date: 8/27/2012 8:50:06 PM ...

IF YOU COULD START OVER...

What is your perfect Drupal theme experience?

Monday, August 27, 2012

Page 26: A new theme layer for Drupal 8? · Drupal 8 Theme layer image by John Albin Wilkins Monday, August 27, 2012. Created Date: 8/27/2012 8:50:06 PM ...

POSSIBLE? REALISTIC?

What is your perfect Drupal theme experience?

Monday, August 27, 2012

Page 27: A new theme layer for Drupal 8? · Drupal 8 Theme layer image by John Albin Wilkins Monday, August 27, 2012. Created Date: 8/27/2012 8:50:06 PM ...

WHAT’S MOST IMPORTANTFOR DRUPAL 8?

1. ?2. ?3. ?

Monday, August 27, 2012

Page 28: A new theme layer for Drupal 8? · Drupal 8 Theme layer image by John Albin Wilkins Monday, August 27, 2012. Created Date: 8/27/2012 8:50:06 PM ...

what does it look like?

TWIG

Monday, August 27, 2012

Page 29: A new theme layer for Drupal 8? · Drupal 8 Theme layer image by John Albin Wilkins Monday, August 27, 2012. Created Date: 8/27/2012 8:50:06 PM ...

what does it look like?

TWIG

print with {{ }}

Monday, August 27, 2012

Page 30: A new theme layer for Drupal 8? · Drupal 8 Theme layer image by John Albin Wilkins Monday, August 27, 2012. Created Date: 8/27/2012 8:50:06 PM ...

what does it look like?

TWIG

commands with {% %}

Monday, August 27, 2012

Page 31: A new theme layer for Drupal 8? · Drupal 8 Theme layer image by John Albin Wilkins Monday, August 27, 2012. Created Date: 8/27/2012 8:50:06 PM ...

what does it look like?

TWIG

comments with {# #}

Monday, August 27, 2012

Page 32: A new theme layer for Drupal 8? · Drupal 8 Theme layer image by John Albin Wilkins Monday, August 27, 2012. Created Date: 8/27/2012 8:50:06 PM ...

what does it look like?

TWIG

simple and intuitive

Monday, August 27, 2012

Page 33: A new theme layer for Drupal 8? · Drupal 8 Theme layer image by John Albin Wilkins Monday, August 27, 2012. Created Date: 8/27/2012 8:50:06 PM ...

TWIG

D7

D8

theme_username becomes username.twigMonday, August 27, 2012

Page 34: A new theme layer for Drupal 8? · Drupal 8 Theme layer image by John Albin Wilkins Monday, August 27, 2012. Created Date: 8/27/2012 8:50:06 PM ...

TWIG

D7

D8

theme_image becomes image.twigMonday, August 27, 2012

Page 35: A new theme layer for Drupal 8? · Drupal 8 Theme layer image by John Albin Wilkins Monday, August 27, 2012. Created Date: 8/27/2012 8:50:06 PM ...

TWIG

D7

D8

theme_link becomes link.twigMonday, August 27, 2012

Page 36: A new theme layer for Drupal 8? · Drupal 8 Theme layer image by John Albin Wilkins Monday, August 27, 2012. Created Date: 8/27/2012 8:50:06 PM ...

TWIGD7 D8

theme_item_list beomes item_list.twigMonday, August 27, 2012

Page 37: A new theme layer for Drupal 8? · Drupal 8 Theme layer image by John Albin Wilkins Monday, August 27, 2012. Created Date: 8/27/2012 8:50:06 PM ...

DO WE GO WITH TWIG?

Monday, August 27, 2012

Page 38: A new theme layer for Drupal 8? · Drupal 8 Theme layer image by John Albin Wilkins Monday, August 27, 2012. Created Date: 8/27/2012 8:50:06 PM ...

HOW DO WE GET THERE?

Monday, August 27, 2012

Page 39: A new theme layer for Drupal 8? · Drupal 8 Theme layer image by John Albin Wilkins Monday, August 27, 2012. Created Date: 8/27/2012 8:50:06 PM ...

DISCUSS!

Monday, August 27, 2012

Page 40: A new theme layer for Drupal 8? · Drupal 8 Theme layer image by John Albin Wilkins Monday, August 27, 2012. Created Date: 8/27/2012 8:50:06 PM ...

with jenlampton, chx, JohnAlbin, mortendk, effulgentsia, EclipseGc, davidneedham

A NEW THEME LAYER FOR D8

http://bit.ly/O6XPFA

Monday, August 27, 2012

Page 41: A new theme layer for Drupal 8? · Drupal 8 Theme layer image by John Albin Wilkins Monday, August 27, 2012. Created Date: 8/27/2012 8:50:06 PM ...

credits:

DrupalCon Munich Slide Deck:http://munich2012.drupal.org/speakers/speaker-resources

Drupal 7 Theme layer imageby John Albin Wilkins

Drupal 8 Theme layer imageby John Albin Wilkins

Monday, August 27, 2012