You are here

interface WorkspaceNegotiatorInterface in Workspace 8.2

Workspace negotiators provide a way to get the active workspace.

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

Hierarchy

Expanded class hierarchy of WorkspaceNegotiatorInterface

All classes that implement WorkspaceNegotiatorInterface

File

src/Negotiator/WorkspaceNegotiatorInterface.php, line 14

Namespace

Drupal\workspace\Negotiator
View source
interface WorkspaceNegotiatorInterface {

  /**
   * Checks whether the negotiator applies to the current request or not.
   *
   * @param \Symfony\Component\HttpFoundation\Request $request
   *   The HTTP request.
   *
   * @return bool
   *   TRUE if the negotiator applies for the current request, FALSE otherwise.
   */
  public function applies(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.
   *
   * @param \Symfony\Component\HttpFoundation\Request $request
   *   The HTTP request.
   *
   * @return \Drupal\workspace\WorkspaceInterface|null
   *   The negotiated workspace or NULL if the negotiator could not determine a
   *   valid workspace.
   */
  public function getActiveWorkspace(Request $request);

  /**
   * Sets the negotiated workspace.
   *
   * @param \Drupal\workspace\WorkspaceInterface $workspace
   *   The workspace entity.
   */
  public function setActiveWorkspace(WorkspaceInterface $workspace);

}

Members

Namesort descending Modifiers Type Description Overrides
WorkspaceNegotiatorInterface::applies public function Checks whether the negotiator applies to the current request or not. 2
WorkspaceNegotiatorInterface::getActiveWorkspace public function Gets the negotiated workspace, if any. 2
WorkspaceNegotiatorInterface::setActiveWorkspace public function Sets the negotiated workspace. 2