Speaker Deck

Short Twig recipes for Drupalers

by Tamás Hajas

Published November 26, 2016 in Technology

So you hopped on the Drupal 8 bandwagon and know the general concepts of Twig. But a general documentation can't give answer to all the specific problems you face when you work on a concrete project.

Fear no more: here I am! The man who neither able to answer all your specific questions… ;) But the man who faced with his own Twig riddles too and found solutions here and there. Who will be glad to share the Twig recipes he collected with you. Eg.:

- How to add custom CSS classes to menu items based on menu name?
- How to add "bundle" CSS classes to nodes?
- How to add "bundle" CSS classes to fields?
- How to add "bundle" CSS classes to blocks?
- Why and how to use twig extends?
- How to display custom dates in a localize-able way?
- How to add "first" / "last" CSS classes and item count to lists?
- etc.

Slides from my presentation at IronCamp, Prague, Czech Republic Nov. 24–27., 2016. http://www.drupalironcamp.com/content/short-twig-recipes-drupalers

Original slides: http://thamas.gitlab.io/d8twig-recipes/

Session video: https://www.youtube.com/watch?v=HhvkagTpxaE