3 namespace Drupal\workspaces\Negotiator;
5 use Drupal\workspaces\WorkspaceInterface;
6 use Symfony\Component\HttpFoundation\Request;
9 * Workspace negotiators provide a way to get the active workspace.
11 * \Drupal\workspaces\WorkspaceManager acts as the service collector for
12 * Workspace negotiators.
14 interface WorkspaceNegotiatorInterface {
17 * Checks whether the negotiator applies to the current request or not.
19 * @param \Symfony\Component\HttpFoundation\Request $request
23 * TRUE if the negotiator applies for the current request, FALSE otherwise.
25 public function applies(Request $request);
28 * Gets the negotiated workspace, if any.
30 * Note that it is the responsibility of each implementation to check whether
31 * the negotiated workspace actually exists in the storage.
33 * @param \Symfony\Component\HttpFoundation\Request $request
36 * @return \Drupal\workspaces\WorkspaceInterface|null
37 * The negotiated workspace or NULL if the negotiator could not determine a
40 public function getActiveWorkspace(Request $request);
43 * Sets the negotiated workspace.
45 * @param \Drupal\workspaces\WorkspaceInterface $workspace
46 * The workspace entity.
48 public function setActiveWorkspace(WorkspaceInterface $workspace);