Introducing Twig
Twig (http://twig.sensiolabs.org) is the new template engine introduced to Drupal 8 and is a companion to Symfony, the new PHP framework that Drupal 8 is built on. Twig provides us with a fast and secure way to separate content from PHP logic in a manner that makes it easier for non-developers to work with templates. To help us get a better feel in order to work with Twig, let's first dive into the steps involved in enabling Twig debugging.
Enabling Twig debug
When Twig debugging is turned on within Drupal, we are able to trace which template is being used, where a template is located, and a list of suggested file names to override a template. This functionality is very advantageous and actually quite simple to set up by following these steps:
Open the
development.services.yml
file located in thesites
folder.Add the following lines to the bottom of the file:
parameters: twig.config: debug : true auto_reload: true cache: false
Save the file.
Clear Drupal's cache...