tempstore_plus
54 sites
Security covered
Tempstore+ makes Edit Mode work on non-layout builder pages for the + Suite page builder.
▶ Watch an introduction to +Suite
Overview
Tempstore + extends Drupal's temporary storage system with a flexible strategy pattern, enabling multiple modules to customize tempstore behavior without conflicts.
Problem
Drupal's core LayoutTempstoreRepository is designed to handle Layout Builder section storage. However, other modules and systems need different tempstore behaviors. Without tempstore_plus, each module must override layout_builder.tempstore_repository directly, which:
- Conflicts when multiple modules try to override the same service
- Complex inheritance chains that are difficult to maintain
- Challenges supporting optional module dependencies
Solution
Tempstore + implements the Strategy Pattern for tempstore operations:
- Strategies implement
TempstoreStrategyInterfaceand define logic for specific
storage types - Tagged services are automatically discovered and registered with configurable
priority - Priority-based selection ensures the right strategy handles each tempstore operation
Features
- Workspace Awareness: Built-in support for workspace isolation via
WorkspaceKeyTrait - Extensible: Add custom strategies by creating a class and tagging it as a service
- No Conflicts: Multiple modules can provide strategies without overriding each other
- Backward Compatible: Works alongside modules that haven't adopted the pattern yet
Included Strategies
- LayoutTempstoreStrategy: Handles Layout Builder section storage with workspace
awareness - EntityTempstoreStrategy: Adds tempstore functionality for non-Layout Builder pages