You are here

public function SessionWorkspaceNegotiator::getActiveWorkspace in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/workspaces/src/Negotiator/SessionWorkspaceNegotiator.php \Drupal\workspaces\Negotiator\SessionWorkspaceNegotiator::getActiveWorkspace()

File

core/modules/workspaces/src/Negotiator/SessionWorkspaceNegotiator.php, line 64

Class

SessionWorkspaceNegotiator
Defines the session workspace negotiator.

Namespace

Drupal\workspaces\Negotiator

Code

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