class WorkspacesLayoutTempstoreRepository
Same name and namespace in other branches
- 11.x core/modules/workspaces/src/WorkspacesLayoutTempstoreRepository.php \Drupal\workspaces\WorkspacesLayoutTempstoreRepository
Provides a mechanism for loading workspace-specific layout changes.
Hierarchy
- class \Drupal\layout_builder\LayoutTempstoreRepository implements \Drupal\layout_builder\LayoutTempstoreRepositoryInterface
- class \Drupal\workspaces\WorkspacesLayoutTempstoreRepository extends \Drupal\layout_builder\LayoutTempstoreRepository
Expanded class hierarchy of WorkspacesLayoutTempstoreRepository
File
-
core/
modules/ workspaces/ src/ WorkspacesLayoutTempstoreRepository.php, line 13
Namespace
Drupal\workspacesView source
class WorkspacesLayoutTempstoreRepository extends LayoutTempstoreRepository {
/**
* The workspace manager.
*/
protected WorkspaceManagerInterface $workspaceManager;
/**
* Sets the workspace manager.
*
* @param \Drupal\workspaces\WorkspaceManagerInterface $workspace_manager
* The workspace manager service.
*/
public function setWorkspacesManager(WorkspaceManagerInterface $workspace_manager) : static {
$this->workspaceManager = $workspace_manager;
return $this;
}
/**
* {@inheritdoc}
*/
protected function getKey(SectionStorageInterface $section_storage) : string {
$key = parent::getKey($section_storage);
// Suffix the layout tempstore key with a workspace ID when one is active.
if ($this->workspaceManager
->hasActiveWorkspace()) {
$key .= '.workspace:' . $this->workspaceManager
->getActiveWorkspace()
->id();
}
return $key;
}
}
Members
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.