How to debug Twig (and other new Drupal 8 videos)

Greetings!

This week brings another 4 videos in the Drupal 8 Developer Prep collection where we discuss how to use variables in Twig and debug Twig templates.

I will also be heading to BADCamp in a week to do 2 days of Mentored Training with a small band of awesome Drupalists from around the country. If you're going to be there for the training or the rest of the conference, I'll be looking forward to crossing paths.

Enjoy and have an awesome week!

- Chris Shattuck

New! How to set up a Twig template file and a brief description of Twig variables

Screenshot for How to set up a Twig template file and a brief description of Twig variables

In this video we create our first Twig template file, get it set up in the right place, and then talk a bit about how variables work in a template.

New! How to register a Twig template file with hook_theme()

Screenshot for How to register a Twig template file with hook_theme()

After creating our template file, the next logical step is to register it with hook_theme() so Drupal knows where it is.

New! How to wire up a Twig template to a render array

Screenshot for How to wire up a Twig template to a render array

Now that we have our Twig template in the theme registry, it’s time to actually use it. In this video we show one approach to using the template file, which is pushing it through a render array.

New! (FREE!) How to easily debug Twig templates by reloading updated template files automatically

Screenshot for How to easily debug Twig templates by reloading updated template files automatically

One thing that you might be missing if you’re upgrading from Drupal 7 is the flexibility of being able to use PHP in your template to figure out what variables you have to work with. Luckily, Twig comes with a nice feature that allows you do exactly that without the security risk of using PHP directly.

Add to playlist

Add to , or

Add to new playlist:

Add to playlist
This is a member-only feature
But, it's easy to become a member

Add to cart:


Loading...
Contact us

Below are the supported keyboard shortcuts for our video player.

space
Start / stop video
shift
Go to next video
shift
Go to previous video
Increase or decrease player speed by 20%
Skip ahead or go back by 15 seconds
1...9
Jump to a percentage (2 is 20%, for example)
f
Toggle full screen
Videos Pricing More Search
BuildAModule Logo Icon BuildAModule Logo Icon
Become a member!
$29
1 month
$156
6 months
10% off
$276
12 months
20% off
All memberships come with the following:
24 / 7 access to the entire 1800+ video library
An innovative video player with a rolling transcript
Extensive Drupal and cross-platform training
A thorough and thoughtful training style
Progress tracking
Take notes on specific video sections
Intuitive multi-user management
How many users?
user
Go solo with a single user, or give multiple team members access through one account and get discounts by bundling multiple users into a single membership.