class WorkspacesLayoutTempstoreRepository

Same name and namespace in other branches
  1. 11.x core/modules/workspaces/src/WorkspacesLayoutTempstoreRepository.php \Drupal\workspaces\WorkspacesLayoutTempstoreRepository

Provides a mechanism for loading workspace-specific layout changes.

Hierarchy

Expanded class hierarchy of WorkspacesLayoutTempstoreRepository

File

core/modules/workspaces/src/WorkspacesLayoutTempstoreRepository.php, line 13

Namespace

Drupal\workspaces
View 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

Title Sort descending Modifiers Object type Summary Overriden Title
LayoutTempstoreRepository::$cache protected property The static cache of loaded values.
LayoutTempstoreRepository::$tempStoreFactory protected property The shared tempstore factory.
LayoutTempstoreRepository::delete public function Overrides LayoutTempstoreRepositoryInterface::delete
LayoutTempstoreRepository::get public function Overrides LayoutTempstoreRepositoryInterface::get
LayoutTempstoreRepository::getTempstore protected function Gets the shared tempstore.
LayoutTempstoreRepository::has public function Overrides LayoutTempstoreRepositoryInterface::has
LayoutTempstoreRepository::set public function Overrides LayoutTempstoreRepositoryInterface::set
LayoutTempstoreRepository::__construct public function LayoutTempstoreRepository constructor.
WorkspacesLayoutTempstoreRepository::$workspaceManager protected property The workspace manager.
WorkspacesLayoutTempstoreRepository::getKey protected function Overrides LayoutTempstoreRepository::getKey
WorkspacesLayoutTempstoreRepository::setWorkspacesManager public function Sets the workspace manager.

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