function WorkspaceCacheContext::getContext

Same name in other branches
  1. 8.9.x core/modules/workspaces/src/WorkspaceCacheContext.php \Drupal\workspaces\WorkspaceCacheContext::getContext()
  2. 10 core/modules/workspaces/src/WorkspaceCacheContext.php \Drupal\workspaces\WorkspaceCacheContext::getContext()
  3. 11.x core/modules/workspaces/src/WorkspaceCacheContext.php \Drupal\workspaces\WorkspaceCacheContext::getContext()

Overrides CacheContextInterface::getContext

File

core/modules/workspaces/src/WorkspaceCacheContext.php, line 42

Class

WorkspaceCacheContext
Defines the WorkspaceCacheContext service, for "per workspace" caching.

Namespace

Drupal\workspaces

Code

public function getContext() {
    return $this->workspaceManager
        ->hasActiveWorkspace() ? $this->workspaceManager
        ->getActiveWorkspace()
        ->id() : 'live';
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.