Drupal's Plus Suite page builder

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 TempstoreStrategyInterface and 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

Comments

tim bozeman created an issue. See original summary.

tim bozeman’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.