You are here

Twig recipes: Making Drupal 8 render the markup you want

Track: 
Design & Theming
Experience Level: 
Beginner
Timeslot: 
Saturday, 9:15am - 10:15am
Session Length: 
60 minutes

Twig recipes: Making Drupal 8 render the markup you want

The addition of Twig has revolutionized the way we do theming in Drupal 8. Although very powerful, it is still fairly new to most of us. Using Twig requires us to take a new approach in order to produce the markup that we want. This session will be a presentation on how to use new features provided by Twig.

Some recipes that will be covered include:

* How can I pass information from Drupal to Twig?
* How can I conditionally render fields based on the content of other fields?
* How can I render image fields as background images?
* How can I render node content as HTML attributes?
* How do I create an absolute link to a node?

This session has been presented at other camps. The current slide deck is available at http://bit.ly/twig-recipes

Learning Objectives & Outcomes: 

Attendees will learn the how Drupal templates work and the basics Twig's syntax. They will also learn the process of finding the right templates to create or modify and how to manipulate template variables to produce custom markup.