interface WorkspaceManagerInterface

Provides an interface for managing Workspaces.

Hierarchy

Expanded class hierarchy of WorkspaceManagerInterface

All classes that implement WorkspaceManagerInterface

21 files declare their use of WorkspaceManagerInterface
ActiveWorkspaceCheck.php in core/modules/workspaces/src/Access/ActiveWorkspaceCheck.php
ActiveWorkspaceCheckTest.php in core/modules/workspaces/tests/src/Unit/ActiveWorkspaceCheckTest.php
ActiveWorkspaceTestForm.php in core/modules/workspaces/tests/modules/workspaces_test/src/Form/ActiveWorkspaceTestForm.php
EntityAccess.php in core/modules/workspaces/src/Hook/EntityAccess.php
EntityOperations.php in core/modules/workspaces/src/Hook/EntityOperations.php

... See full list

File

core/modules/workspaces/src/WorkspaceManagerInterface.php, line 8

Namespace

Drupal\workspaces
View source
interface WorkspaceManagerInterface {
  
  /**
   * Determines whether a workspace is active in the current request.
   *
   * @return bool
   *   TRUE if a workspace is active, FALSE otherwise.
   */
  public function hasActiveWorkspace();
  
  /**
   * Gets the active workspace.
   *
   * @return \Drupal\workspaces\WorkspaceInterface|null
   *   The active workspace entity, or NULL if there's no active workspace.
   */
  public function getActiveWorkspace();
  
  /**
   * Sets the active workspace.
   *
   * @param \Drupal\workspaces\WorkspaceInterface $workspace
   *   The workspace to set as active.
   * phpcs:ignore
   * @param bool $persist
   *   (optional) Whether to persist this workspace in the first applicable
   *   negotiator. Defaults to TRUE.
   *
   * @return $this
   *
   * @throws \Drupal\workspaces\WorkspaceAccessException
   *   Thrown when the current user doesn't have access to view the workspace.
   */
  public function setActiveWorkspace(WorkspaceInterface $workspace);
  
  /**
   * Unsets the active workspace.
   *
   * @return $this
   */
  public function switchToLive();
  
  /**
   * Executes the given callback function in the context of a workspace.
   *
   * @param string $workspace_id
   *   The ID of a workspace.
   * @param callable $function
   *   The callback to be executed.
   *
   * @return mixed
   *   The callable's return value.
   */
  public function executeInWorkspace($workspace_id, callable $function);
  
  /**
   * Executes the given callback function without any workspace context.
   *
   * @param callable $function
   *   The callback to be executed.
   *
   * @return mixed
   *   The callable's return value.
   */
  public function executeOutsideWorkspace(callable $function);
  
  /**
   * Deletes the revisions associated with deleted workspaces.
   *
   * @deprecated in drupal:11.3.0 and is removed from drupal:12.0.0. There is
   *   no replacement.
   *
   * @see https://www.drupal.org/node/3553582
   */
  public function purgeDeletedWorkspacesBatch();

}

Members

Title Sort descending Deprecated Modifiers Object type Summary Overrides
WorkspaceManagerInterface::executeInWorkspace public function Executes the given callback function in the context of a workspace. 1
WorkspaceManagerInterface::executeOutsideWorkspace public function Executes the given callback function without any workspace context. 1
WorkspaceManagerInterface::getActiveWorkspace public function Gets the active workspace. 1
WorkspaceManagerInterface::hasActiveWorkspace public function Determines whether a workspace is active in the current request. 1
WorkspaceManagerInterface::purgeDeletedWorkspacesBatch Deprecated public function Deletes the revisions associated with deleted workspaces. 1
WorkspaceManagerInterface::setActiveWorkspace public function Sets the active workspace. 1
WorkspaceManagerInterface::switchToLive public function Unsets the active workspace. 1

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