| Understand how Twig templates work in Drupal |
Twig Overview |
| Name my template file correctly |
Template Discovery & Naming |
| Know what templates exist in what order |
Template Hierarchy |
| Know what variables are available in html/page/node/field templates |
Variables by Template Level |
| Access a field value in a Twig template |
Accessing Field Values |
| Follow entity references (node → media → image) |
Entity Reference Traversal |
| Loop over multi-value fields |
Multi-Value Fields |
| Add/remove CSS classes and HTML attributes |
The Attribute System |
| Write a preprocess function |
Preprocess Functions |
| Pass custom data from PHP to a template |
Adding Variables in Preprocess |
| Register a new theme hook |
Theme Hooks & Registration |
| Add or override template suggestions |
Template Suggestions |
| Use url(), path(), link(), file_url() in Twig |
Drupal Twig Functions |
| Use |t, |without, |clean_class, |render in Twig |
Drupal Twig Filters |
| Use twig_tweak to render a view/block/entity |
Twig Tweak Module |
| Include an SDC component from a Twig template |
SDC in Templates |
| Debug which template is being used |
Template Debugging |
| Use extends, include, embed |
Template Inheritance |
| Know security and performance rules |
Security & Performance |
| Avoid common Twig mistakes |
Anti-Patterns |
| Find the relevant core source files |
Code Reference Map |