Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem
The context system provide no way to serialize contexts to scalar values, e.g. entities to their IDs. This is problematic for important cases like integrating context-aware blocks with dynamic page cache, which requires scalar arguments for it's lazy builders. Related issue: #2944814: Add support for lazy_builders and dynamic page cache
While not every context may be serializable, most are - so the API should provide a way to serialize the context if possible. The calling code will have to figure out what to do in the other case.
Comments
Comment #2
fago