You can get the paragraphs in your nodes ready for the ToC module using these Twig templates.
twig
ternary-example.html.twig
{# Checks if a URL exists and passes it to the component. Otherwise, sets it to false. Works with primitive data types. #}
{% set link = url ? { url: url } : false %}
{# Checks if the media object is not empty and passes it to the component. Otherwise, sets it to false. Suitable for complex data types like objects. #}
{% set media = media is not empty ? { media: media } : false %}
13.11.2025 | Lothar Ferreira Neumann
Use ternary statements in Twig
This is not a thing anymore.
Unfortunately, this was removed in macOS 26. Thus, the DevBit goes internal. Unfortunate – it has been public for a few minutes only. =(
html.html.twig
<!DOCTYPE html>
<html{{ html_attributes }}>
<head>
<head-placeholder token="{{ placeholder_token|raw }}">
<meta name="theme-color" content="#ef9222">
<title>{{ head_title|safe_join(' | ') }}</title>
<css-placeholder token="{{ placeholder_token|raw }}">
<js-placeholder token="{{ placeholder_token|raw }}">
</head>
<body{{ attributes }}>
{#...#}
</body>
</html>
10.09.2026 | Holger Weischenberg
Color the Safari Toolbar
add-to-first-position.twig
{# The elements array we want to add a '0' to at the beginning. #}
{% set elements = ['1', '2', '3'] %}
{# Working: Merge elements to a new array and override the variable. The result will be ['0', '1', '2', '3']. #}
{% set elements = ['0']|merge(elements) %}
{# Not working: The result will be ['1', '2', '3', '0']. #}
{% set elements = elements|merge(['0']) %}
05.10.2026 | Pascal Crott
How to add an element to an array at the first position in Twig
We will use the form_decorator module to alter the output of the gin_login module to look something like this:
This DevBit provides a step-by-step tutorial how to get there.
23.04.2026 | Lothar Ferreira Neumann
Add custom text to gin_login with Form Decorator
development.services.yml
parameters:
twig.config:
debug: true
auto_reload: null
cache: false
22.06.2026 | Mathias Grab
How to enable Twig debug in Drupal
13.11.2025 | Peter Gerken