function WorkspaceManager::setActiveWorkspace

Same name in other branches
  1. 9 core/modules/workspaces/src/WorkspaceManager.php \Drupal\workspaces\WorkspaceManager::setActiveWorkspace()
  2. 8.9.x core/modules/workspaces/src/WorkspaceManager.php \Drupal\workspaces\WorkspaceManager::setActiveWorkspace()
  3. 11.x core/modules/workspaces/src/WorkspaceManager.php \Drupal\workspaces\WorkspaceManager::setActiveWorkspace()

File

core/modules/workspaces/src/WorkspaceManager.php, line 213

Class

WorkspaceManager
Provides the workspace manager.

Namespace

Drupal\workspaces

Code

public function setActiveWorkspace(WorkspaceInterface $workspace) {
    $this->doSwitchWorkspace($workspace);
    // Set the workspace on the proper negotiator.
    $request = $this->requestStack
        ->getCurrentRequest();
    foreach ($this->negotiatorIds as $negotiator_id) {
        $negotiator = $this->classResolver
            ->getInstanceFromDefinition($negotiator_id);
        if ($negotiator->applies($request)) {
            $negotiator->setActiveWorkspace($workspace);
            break;
        }
    }
    return $this;
}

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