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.
By plach on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
8.0.x
Introduced in version:
8.0.0-BETA13
Description:
The following interface should be implemented by any class whose business logic implies dealing at runtime with variations of a canonical object:
interface RefinableCacheableDependencyInterface {
public function addCacheContexts(array $cache_contexts);
public function addCacheTags(array $cache_tags);
public function mergeCacheMaxAge($max_age);
}
Typical examples are:
- Code relying on the current content language to decided which entity translation should be displayed.
EntityManager::getTranslationFromContext()
now automatically takes care of these cases, that is when no language parameter is explicitly provided. - Configuration overrides: in core configuration may vary by interface language, which is a required cache context. However contrib can implement additional overrides, for instance Domain Access or Organic Groups: these will require to specify their additional cache contexts dependencies at runtime.
Impacts:
Module developers