Twig Recipes - Making Drupal 8 Render the Markup You Want

53:54
105
2
0
0
0
Share
Jun 30, 2018

Mauricio Dinarte

“Understanding the process of finding a solution is far more valuable than the solution itself.” - Lea Verou, author of CSS Secrets.

The addition of Twig has revolutionized the way we do theming in Drupal 8. Although very powerful and expressive, it is significantly different to what we did before. Using Twig requires us to take a new approach in order to make Drupal produce the markup that we want. This session is aimed at site builders and themers who want to understand how Twig works in Drupal 8. Basic theming concepts will be presented so no prior knowledge is required to attend.

You will learn what a theme is responsible for when generating a Drupal page. Templates, template nesting, and theme debug will also be explained so that you know where to look when trying to modify the default markup. Twig’s syntax, filters, functions, and tests will be presented as the basis for writing templates. All of these in the context of practical examples some of which come from Drupal core itself.

By the end of the session, you will have a better understanding on how Twig works in Drupal 8 and the thought process required to produce custom markup.

Learning objectives

How to pass information from Drupal to Twig?
How to conditionally hide/show fields based on the content of other fields?
How to use image fields as background images?
How to render node content as HTML attributes?

http://design4drupal.org/sessions/theming/twig-recipes-making-drupal-8-…

Hi! I'm Karim Boudjema, the developer and site-builder of this site. I'm currently working as a freelance Drupal developer.

I was wondering how could I giving back to the Drupal community all what it gave to me during the last 10 years, that's how the idea of this site came to me ... (read more)

Hi! I’m Santiago Rico, the web designer and themer of this site.

When Karim proposed me to design and theme this site for the Drupal community, I accepted immediately because the community is the main reason why I love Drupal so much.