Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: Views Bootstrap 5.5.4 — Minor update available for module views_bootstrap (5.5.4). Release: ChatGPT Ads 1.0.3 — Minor update available for module chatgpt_ads (1.0.3). Release: Opensolr Search 5.1.3 — Minor update available for module opensolr_search (5.1.3). Release: ServiceM8 Webform Integration 1.2.1 — Minor update available for module servicem8_webform (1.2.1). Release: PostfixAdmin 1.0.0 — Initial release available for module postfix_admin (1.0.0)! Release: MCP Sentinel 2.28.2 — Minor update available for module mcp_sentinel (2.28.2). Release: Rightup theme 1.0.2 — Minor update available for theme vartheme_bs5_rightup (1.0.2). Release: ip_analyser 1.0.3 — Minor update available for module ip_analyser (1.0.3). Security Coverage: Microsoft Azure AI — Module ai_provider_azure now has official Drupal security advisory coverage. Module Revived: Liquid Voting 2.0.1 — Module liquid_voting updated after 6 months of inactivity (2.0.1).

Context Stack

Security covered

Part of the Context ecosystem · 6 projects

View on drupal.org

Important: Due to resource problems, this module is not recommended anymore. Only security and maintenance fixes will be applied.

Use data from stacked context in Blocks, Views, Tokens and anywhere context is used.

Installation

  • This module requires no modules outside of Drupal core.
  • Install the module as you would normally install a contributed Drupal module. Visit https://www.drupal.org/node/1897420 for further information.

Usage

Once installed, you get a variety of options to choose from in the configuration of Blocks via Block Layout, Layout Builder and default arguments for Views contextual filters, namely from the following available context stacks:

  • The "view" context is a stack of entities being viewed. For example, if you view a node in full view mode which in turn renders a user in picture view mode, you can access both entities. You need to install the "Context Stack View" sub-module for being able to use the "view" context stack.
  • The "form" context is a stack of entities that belong to a form that is being displayed. For example, when you have a form to edit a node opened on your page, and that form contains another entity via inline entity form, you can access both entities. You need to install the "Context Stack Form" sub-module for being able to use the "form" context stack.
  • The "account" context is a stack of current users. This stack may be of interest if you want to do some nested account switching. You need to install the "Context Stack Account" sub-module for being able to use the "account" context stack.

For each stack, you can access the current context, but also the parent (superordinate) context and root context.

You can access "current", "parent" and "root" contexts via Tokens, for example [current:view:node:title], [parent:view:node:title], [root:view:node:title].

Complementary modules

This module may be especially useful when using the Token filter module, allowing to access the current node or other entities from the "view" stack.

The Views Tokenized module enables using Tokens within Views, including all Tokens provided by Context Stack.

The ECA Context module integrates ECA: Event - Condition - Action by providing its own "eca" context stack. That enables you to access objects defined from parent and root processes.

The Flow module contains a "flow" context stack integration.

API

This module is a framework for other modules that need complex context logic. Besides "view" and "account", additional stack purposes can be added by service definition like the following in your services.yml file:

services:
  context_stack.my_stack:
    class: Drupal\context_stack\ContextStack
    factory: ['@context_stack.factory', createStack]
    arguments: [my_stack]
    tags:
      - { name: context_stack }

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
2
Tracked since
Jan 2023
Latest release
3 years ago
Releases (12 mo)
0
Maintenance
Dormant

Releases

Version Type Core Release date
1.1.2 Stable Feb 17, 2023
1.1.1 Stable Jan 27, 2023