What is Twig Logic?
I’m defining
Twig Logic
to mean any and all manipulation inside a twig template.
Examples
Example 1a - simple
Example 1b - a little more complicated
Example 1c - even more complicated
Example 1d - an alternate approach
References and further reading
Drupal core twig functions
- The twig functions included with Drupal core
Drupal core twig filters
- The twig filters included with Drupal core
Twig Tweak
- provides a number of useful twig functions and filters
Twig Real Content
- provides a useful
real_content
condition to check if a rendered string contains actual data and not just empty wrappers