public function WorkspaceManager::getActiveWorkspace in Workspace 8.2
Gets the active workspace.
Return value
\Drupal\workspace\WorkspaceInterface The active workspace entity object.
Overrides WorkspaceManagerInterface::getActiveWorkspace
File
- src/
WorkspaceManager.php, line 149
Class
- WorkspaceManager
- Provides the workspace manager.
Namespace
Drupal\workspaceCode
public function getActiveWorkspace() {
if (!isset($this->activeWorkspace)) {
$request = $this->requestStack
->getCurrentRequest();
foreach ($this->negotiatorIds as $negotiator_id) {
$negotiator = $this->classResolver
->getInstanceFromDefinition($negotiator_id);
if ($negotiator
->applies($request)) {
if ($this->activeWorkspace = $negotiator
->getActiveWorkspace($request)) {
break;
}
}
}
}
// The default workspace negotiator always returns a valid workspace.
return $this->activeWorkspace;
}