interface WorkspaceNegotiatorInterface (View source)

Workspace negotiators provide a way to get the active workspace.

\Drupal\workspaces\WorkspaceManager acts as the service collector for Workspace negotiators.

Methods

bool
applies(Request $request)

Checks whether the negotiator applies to the current request or not.

getActiveWorkspace(Request $request)

Gets the negotiated workspace, if any.

setActiveWorkspace(WorkspaceInterface $workspace)

Sets the negotiated workspace.

unsetActiveWorkspace()

Unsets the negotiated workspace.

Details

bool applies(Request $request)

Checks whether the negotiator applies to the current request or not.

Parameters

Request $request

The HTTP request.

Return Value

bool

TRUE if the negotiator applies for the current request, FALSE otherwise.

WorkspaceInterface|null getActiveWorkspace(Request $request)

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

Request $request

The HTTP request.

Return Value

WorkspaceInterface|null

The negotiated workspace or NULL if the negotiator could not determine a valid workspace.

setActiveWorkspace(WorkspaceInterface $workspace)

Sets the negotiated workspace.

Parameters

WorkspaceInterface $workspace

The workspace entity.

unsetActiveWorkspace()

Unsets the negotiated workspace.