function WorkspacesLayoutTempstoreRepository::getKey

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

Gets the string to use as the tempstore key.

Parameters

\Drupal\layout_builder\SectionStorageInterface $section_storage: The section storage.

Return value

string A unique string representing the section storage. This should include as much identifying information as possible about this particular storage, including information like the current language.

Overrides LayoutTempstoreRepository::getKey

File

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

Class

WorkspacesLayoutTempstoreRepository
Provides a mechanism for loading workspace-specific layout changes.

Namespace

Drupal\workspaces

Code

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;
}

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