Twig Globals

Categories

Component ID

2612132

Component name

Twig Globals

Component type

module

Maintenance status

Development status

Component security advisory coverage

not-covered

Component created

Component changed

Component body

Provides a bunch of global Twig variables that used to be available in one or more templates in D7 but were, for various reasons, not migrated to Drupal 8. The hope is that this module will move into Drupal 8 core in the 8.1.x release cycle.

Currently supported:

Base dir: {{ drupalGlobals.basePath }}
Active theme: {{ drupalGlobals.activeThemeName }}
Active theme path: {{ drupalGlobals.activeThemePath }}
Is front page: {{ dump(drupalGlobals.isFrontPage) }}
Is logged in: {{ dump(drupalGlobals.isLoggedIn) }}
Is UID1: {{ dump(drupalGlobals.isUserId1) }}

Please help by adding issues with the component set to "Missing variable" if you find things that used to be in D7 missing in D8. Or new variables in D8 that should be available to all templates.

See also: #2168231: Twig Functions needed in templates.