function TestWorkspaceNegotiator::getActiveWorkspace

Same name and namespace in other branches
  1. 8.9.x core/modules/workspaces/tests/modules/workspace_update_test/src/Negotiator/TestWorkspaceNegotiator.php \Drupal\workspace_update_test\Negotiator\TestWorkspaceNegotiator::getActiveWorkspace()
  2. 10 core/modules/workspaces/tests/modules/workspace_update_test/src/Negotiator/TestWorkspaceNegotiator.php \Drupal\workspace_update_test\Negotiator\TestWorkspaceNegotiator::getActiveWorkspace()
  3. 11.x core/modules/workspaces/tests/modules/workspace_update_test/src/Negotiator/TestWorkspaceNegotiator.php \Drupal\workspace_update_test\Negotiator\TestWorkspaceNegotiator::getActiveWorkspace()

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\workspaces\WorkspaceInterface|null The negotiated workspace or NULL if the negotiator could not determine a valid workspace.

Overrides WorkspaceNegotiatorInterface::getActiveWorkspace

File

core/modules/workspaces/tests/modules/workspace_update_test/src/Negotiator/TestWorkspaceNegotiator.php, line 25

Class

TestWorkspaceNegotiator
Defines a workspace negotiator used for testing.

Namespace

Drupal\workspace_update_test\Negotiator

Code

public function getActiveWorkspace(Request $request) {
    return Workspace::create([
        'id' => 'test',
        'label' => 'Test',
    ]);
}

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