public function SessionWorkspaceNegotiator::getActiveWorkspace in Workspace 8.2
Gets the negotiated workspace, if any.
Note that it is the responsibility of each implementation to check whether the negotiated workspace actually exists in the storage.
Parameters
\Symfony\Component\HttpFoundation\Request $request: The HTTP request.
Return value
\Drupal\workspace\WorkspaceInterface|null The negotiated workspace or NULL if the negotiator could not determine a valid workspace.
Overrides WorkspaceNegotiatorInterface::getActiveWorkspace
File
- src/
Negotiator/ SessionWorkspaceNegotiator.php, line 64
Class
- SessionWorkspaceNegotiator
- Defines the session workspace negotiator.
Namespace
Drupal\workspace\NegotiatorCode
public function getActiveWorkspace(Request $request) {
$workspace_id = $this->session
->get('active_workspace_id');
if ($workspace_id && ($workspace = $this->workspaceStorage
->load($workspace_id))) {
return $workspace;
}
return NULL;
}