class WorkspaceCacheContext in Multiversion 8
Defines the WorkspaceCacheContext service, for "per workspace" caching.
Cache context ID: 'workspace'.
Hierarchy
- class \Drupal\multiversion\WorkspaceCacheContext implements CacheContextInterface
Expanded class hierarchy of WorkspaceCacheContext
1 string reference to 'WorkspaceCacheContext'
1 service uses WorkspaceCacheContext
File
- src/
WorkspaceCacheContext.php, line 14
Namespace
Drupal\multiversionView source
class WorkspaceCacheContext implements CacheContextInterface {
/**
* The workspace manager.
*
* @var \Drupal\multiversion\Workspace\WorkspaceManagerInterface
*/
protected $workspaceManager;
/**
* Constructs a new WorkspaceCacheContext service.
*
* @param \Drupal\multiversion\Workspace\WorkspaceManagerInterface $workspace_manager
* The workspace manager.
*/
public function __construct(WorkspaceManagerInterface $workspace_manager) {
$this->workspaceManager = $workspace_manager;
}
/**
* {@inheritdoc}
*/
public static function getLabel() {
return t('Workspace');
}
/**
* {@inheritdoc}
*/
public function getContext() {
return 'ws.' . $this->workspaceManager
->getActiveWorkspaceId();
}
/**
* {@inheritdoc}
*/
public function getCacheableMetadata($type = NULL) {
return new CacheableMetadata();
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
WorkspaceCacheContext:: |
protected | property | The workspace manager. | |
WorkspaceCacheContext:: |
public | function |
Gets the cacheability metadata for the context. Overrides CacheContextInterface:: |
|
WorkspaceCacheContext:: |
public | function |
Returns the string representation of the cache context. Overrides CacheContextInterface:: |
|
WorkspaceCacheContext:: |
public static | function |
Returns the label of the cache context. Overrides CacheContextInterface:: |
|
WorkspaceCacheContext:: |
public | function | Constructs a new WorkspaceCacheContext service. |