class WorkspacesAliasManager

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

Decorates the path_alias.manager service for workspace-specific caching.

@internal

Hierarchy

Expanded class hierarchy of WorkspacesAliasManager

File

core/modules/workspaces/src/WorkspacesAliasManager.php, line 14

Namespace

Drupal\workspaces
View source
class WorkspacesAliasManager implements AliasManagerInterface {
  public function __construct(protected readonly AliasManagerInterface $inner, protected readonly WorkspaceManagerInterface $workspaceManager) {
  }
  
  /**
   * {@inheritdoc}
   */
  public function setCacheKey($key) : void {
    if ($this->workspaceManager
      ->hasActiveWorkspace()) {
      $key = $this->workspaceManager
        ->getActiveWorkspace()
        ->id() . ':' . $key;
    }
    $this->inner
      ->setCacheKey($key);
  }
  
  /**
   * {@inheritdoc}
   */
  public function writeCache() : void {
    $this->inner
      ->writeCache();
  }
  
  /**
   * {@inheritdoc}
   */
  public function getPathByAlias($alias, $langcode = NULL) : string {
    return $this->inner
      ->getPathByAlias($alias, $langcode);
  }
  
  /**
   * {@inheritdoc}
   */
  public function getAliasByPath($path, $langcode = NULL) : string {
    return $this->inner
      ->getAliasByPath($path, $langcode);
  }
  
  /**
   * {@inheritdoc}
   */
  public function cacheClear($source = NULL) : void {
    $this->inner
      ->cacheClear($source);
  }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title
WorkspacesAliasManager::cacheClear public function Clears the static caches in alias manager and rebuilds the whitelist. Overrides AliasManagerInterface::cacheClear
WorkspacesAliasManager::getAliasByPath public function Given a path, return the alias. Overrides AliasManagerInterface::getAliasByPath
WorkspacesAliasManager::getPathByAlias public function Given the alias, return the path it represents. Overrides AliasManagerInterface::getPathByAlias
WorkspacesAliasManager::setCacheKey public function
WorkspacesAliasManager::writeCache public function
WorkspacesAliasManager::__construct public function

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