Drupal is a registered trademark of Dries Buytaert
drupal 11.3.8 Update released for Drupal core (11.3.8)! drupal 11.3.7 Update released for Drupal core (11.3.7)! drupal 11.2.11 Update released for Drupal core (11.2.11)! drupal 10.6.7 Update released for Drupal core (10.6.7)! drupal 10.5.9 Update released for Drupal core (10.5.9)! cms 2.1.1 Update released for Drupal core (2.1.1)! drupal 11.3.6 Update released for Drupal core (11.3.6)! drupal 10.6.6 Update released for Drupal core (10.6.6)! cms 2.1.0 Update released for Drupal core (2.1.0)! linkit 7.0.14 Minor update available for module linkit (7.0.14). masquerade 8.x-2.2 Minor update available for module masquerade (8.x-2.2). video_embed_field 3.1.0 Minor update available for module video_embed_field (3.1.0). bootstrap 8.x-3.40 Minor update available for theme bootstrap (8.x-3.40). menu_link_attributes 8.x-1.7 Minor update available for module menu_link_attributes (8.x-1.7). eca 3.1.2 Minor update available for module eca (3.1.2). content_access 2.1.0 Minor update available for module content_access (2.1.0). editoria11y 3.0.2 Minor update available for module editoria11y (3.0.2). rebuild_cache_access 8.x-1.14 Minor update available for module rebuild_cache_access (8.x-1.14). webform 6.3.0-beta9 New beta version released for module webform (6.3.0-beta9). tagify 1.2.51 Minor update available for module tagify (1.2.51).

mgv

489 sites Security covered
View on drupal.org

This is a small module that gives users some global variables that can be then printed in any twig template. For example, if you wanted to print the current page title as the last menu in a breadcrumb, you could print {{ global_variables.current_page_title }} in breadcrumb.html.twig. It can also be printed in any other template - html.html.twig, page.html.twig, node.html.twig, field.html.twig, etc.

Version 2 Pipeline

Version 2.0.0 is identical to 8.x-1.18. It was solely created to align with semantic versioning (semver) standards for releases. All future development strictly occurs across the 2.x branches.

Release History & Innovations

  • 2.0.x: Established structural frameworks permitting dependency injection within Variable plugins, alongside the integration of automated tests and comprehensive PHPCS validations.
  • 2.1.x: Architecture refinement updating the base GlobalVariable definition schemas for enhanced stability.
  • 2.2.x: Restored full PHP 8.1 support natively bridging edge cases (e.g. absent current routes breaking Social Email sharing), updated Twitter share URLs, improved query parameter handling, and baked in early Automated Drupal 11 compatibility.
  • 2.3.x (Current): Major modernization leap transitioning procedural paradigms to OOP execution.
    • Automated cache metadata integration.
    • Global Variable plugins are now natively Context-Aware.
    • Procedural hooks modernized via #[Hook] attributes.
    • Plugin annotations (@Mgv) deprecated in favor of PHP Attributes (#[Variable]).

Recommended Upgrade Path

To safely capitalize on these modern framework architectures without breaking existing cache infrastructures, we strictly recommend a gradual upgrade path. Because context-awareness implementations and service constructor expansions alter the base container mappings, you should upgrade sequentially without skipping minor versions:

  1. First, upgrade to the latest 2.1.x to formalize the plugin foundations.
  2. Upgrade to 2.2.x mapping standard compatibility configurations.
  3. Finally, upgrade to 2.3.x natively executing the database updates. This staggered deployment allows Drupal's cache invalidation engine to seamlessly rewrite the container parameters mitigating fatal pipeline exceptions!

Table of Contents.

  • 1) Paths
    • 1.1) Current Path - {{ global_variables.current_path }}
    • 1.2) Base URL - {{ global_variables.base_url }}
  • 2) Current Items
    • 2.1) Current Page Title - {{ global_variables.current_page_title }}
    • 2.2) Current Langcode - {{ global_variables.current_langcode }}
    • 2.3) Current Langname - {{ global_variables.current_langname }}
  • 3) Site Information Page Global variables
    • 3.1) Site Name - {{ global_variables.site_name }}
    • 3.2) Site Slogan - {{ global_variables.site_slogan }}
    • 3.3) Site Mail - {{ global_variables.site_mail }}
    • 3.4) Site Logo - {{ global_variables.logo }}
  • 4) Social Sharing
    • 4.1) Twitter - {{ global_variables.social_sharing.twitter }}
    • 4.2) Facebook - {{ global_variables.social_sharing.facebook }}
    • 4.3) LinkedIn - {{ global_variables.social_sharing.linkedin }}
    • 4.4) Email - {{ global_variables.social_sharing.email }}
    • 4.5) WhatsApp - {{ global_variables.social_sharing.whatsapp }}

Alternatives

One very flexible way to solve similar issues is to combine Twig Tweak with Custom Token which allows using all global tokens in Twig and to define further custom tokens in the UI.

Activity

Total releases
3
First release
Mar 2026
Latest release
1 month ago
Release cadence
6 days
Stability
0% stable

Release Timeline

Releases

Version Type Release date
2.3.0-rc1 Pre-release Apr 2, 2026
2.3.x-dev Dev Mar 22, 2026
8.x-1.x-dev Dev Mar 22, 2026