Drupal 8 will ship with a fancy new template engine (Twig) and a simpler theme layer. In this webinar, our speaker shows you some goodies from Twig and shares how you can get started with it.
He also talks about the major problems that people were facing in working with Drupal 7 and what the community has done to make it better. This webinar shows - in both practical examples and on a broader scale - why Drupal 8 will make peace between backenders and frontenders.
If you missed the webinar, you can watch the full recording here:
2. Lauri Eskola
I live in Finland
Front and Back End Developer
Mostly working on Core issues
related to Theme system on the
Back End side
Working for Druid
I do actually like cold (and
sauna)
@srijan #SrijanWW
22. Print what you want, when you want
Drupal 7
<?php
//Wehidethecommentsandlinksnowsothatwecanrenderthemlater.
hide($content['comments']);
hide($content['links']);
printrender($content);
Drupal 8
{#Wegiveyouwhatyouaskfor.#}
{{content|without('comments','links')}}
...
{#Anythingcanbeprintedlateron#}
{{content.comments}}
@srijan #SrijanWW
23. Twig filters
Meant to manipulate content. Simply takes the first parameter from a
variable or inline string and returns it in different format.
Example
{%setname='Lauri'%}
{#Printvaribaleusinglenghtfilter.#}
{{name|length}}
Returns
5
@srijan #SrijanWW
24. Twig functions
More viable functions with multiple parameters meant to create simple
front-end logic
{{dump()}}
@srijan #SrijanWW
25. This magic is built in Twig
How ever I'm going to show you how to add these by your self!
@srijan #SrijanWW