What makes Twig tick?

EvanLovely

What makes Twig tick? Where does it get all of its data from? How can I make my own?

And what are those non-standard Twig functions doing there and how did Drupal get them there?!?!

Find out this and more in this deep dive of the templating language that powers the Drupal front-end.

Learn:

  • How to preprocess every Twig file
  • To dive into the PHP Classes that power the Twig variables, which ones you can and cannot use, and why
  • What Twig namespaces are, how Drupal auto assigns them, and how you can create your own
  • How to make your own Twig function that can execute Node.JS - which would allow you to server-side render a JavaScript templating language like React or Vue.
  • Why this is all so important when you are building design systems using pattern libraries like Pattern Lab.

It's important to understand what is core Twig functionality that is available everywhere - in Pattern Lab and in Drupal versus what custom extensions Drupal adds that can only be used in the Drupal environment.

Program tags

front end development, php

Experience Level

Advanced

Drupal Version