Templating with Twig

urvigala
vyasamit2007

Twig, the fast, secure, flexible, modern template engine for PHP, is now a part of Drupal 8.

And like we know, Twig has replaced the default PHP template, most of us still face issues in templating correctly with Twig.

Twig and Symphony in drupal 8 share same initiative of being object oriented programming, hence increasing the understanding, concentration and performance of drupal developers.

So here we shall learn about how to template using Twig, and for that clearly understanding the differences in coding style, standards and syntaxes between the default PHP template and Twig. Its also important to learn how to work with Twig, Debugging Twig template, Understanding use and need of Filters in Twig, handy twig functions, and templating twig with best practices, and preprocess functions.

Overall, it is important to adapt to twig, even while working with Drupal 7, as that can make theme portable for drupal 8 with significant less conversion efforts.

A high level agenda :

  1. Understanding the importance of twig in drupal 8

  2. Difference in coding styles of default PHPtemplate and Twig template

  3. Understanding the syntax, coding standards, and coding style.

  4. Uses and advantages of Twig.

  5. How to write Twig template for D7 so it’s easy for conversion.

Session Track

Front End

Experience Level

Beginner

Drupal Version