Time Slot
Sun 11:00am to 11:45am (10/18/26)
Room
381 - BCIT Downtown
Almost everyone building modern Drupal sites has had some hands-on experience with Twig files, but most people have barely scratched the surface of all the things Twig can do. In this session we are going to discuss the aspects that make Twig amazing, tips and best practices for building modern Drupal sites, and some capabilities of Twig that you’ve never seen before.
Topics covered and what you’ll learn:
- Twig syntax: It is so clean simple and easy to write.
- Safety and resiliency: How Drupal’s Twig implementation protects your site and users from harm.
- Useful filters: There are so many available, provided natively, by Drupal core, and by the Twig Tweak module.
- Variables: Declaring them, overriding them, and providing fallbacks with features like the null coalesce operator.
- Loops and macros: Manipulate and output some complex data structures.
- Processing: How Twig reduces the need for preprocess functions.
- Inheritance: Extend templates for an elegant architecture and less duplicate code.
- Embedding content: Include menus, views, and other entities without relying on the block layout system.
- Single Directory Components: Use Twig to create them. Use Twig to include them.
- Pattern libraries: Use Kalastatic and Twig.js to generate a guide for your theme and components.
- Body-less Drupal: Forget headless Drupal! Let Twig itself generate a static site using your Drupal theme.
Audience: Front-end developers, Drupal site builders, and people looking to broaden their horizons.
Prerequisites: Basic familiarity with Drupal theme structures and editing .html.twig files.
Audience
Intermediate
Session Category
Frontend