Twig in the Wild: Customizing Markup with Minimal PHP Knowledge

Presenter: jkoul
Co-Presenter(s):
n/a

UPDATE: Demo site with presentation and examples: http://jpresentation.dev.bixal.net/

Before Drupal 8 and its integration of Twig, limited PHP knowledge generally meant limited control over your site's theme layer, particularly its templates and markup. Thanks the the power of Twig, you no longer need to be a PHP wizard to work magic with custom templating.

This session walks through the basic structure and usage of Twig templates, including:

  • How do you know when a Twig override is necessary?
  • How do you set up a custom Twig override?
  • How do you determine the right way to access a particular variable's value from a Twig file? 
  • What are the different ways to generate a custom class or other attribute?

The session will also provide a real-world example, demonstrating how jump links to sections within a node's main content can be built in Twig with relative ease.

Audience
Experience Level
Beginner
Schedule Info
Date / Time
Room
Balcony A
Session Track