interface WorkspaceManagerInterface

Same name in other branches
  1. 9 core/modules/workspaces/src/WorkspaceManagerInterface.php \Drupal\workspaces\WorkspaceManagerInterface
  2. 8.9.x core/modules/workspaces/src/WorkspaceManagerInterface.php \Drupal\workspaces\WorkspaceManagerInterface
  3. 11.x core/modules/workspaces/src/WorkspaceManagerInterface.php \Drupal\workspaces\WorkspaceManagerInterface

Provides an interface for managing Workspaces.

Hierarchy

Expanded class hierarchy of WorkspaceManagerInterface

All classes that implement WorkspaceManagerInterface

13 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
EntityReferenceSupportedNewEntitiesConstraintValidator.php in core/modules/workspaces/src/Plugin/Validation/Constraint/EntityReferenceSupportedNewEntitiesConstraintValidator.php
EntityWorkspaceConflictConstraintValidator.php in core/modules/workspaces/src/Plugin/Validation/Constraint/EntityWorkspaceConflictConstraintValidator.php
QueryFactory.php in core/modules/workspaces/src/EntityQuery/QueryFactory.php

... See full list

File

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

Namespace

Drupal\workspaces
View source
interface WorkspaceManagerInterface {
    
    /**
     * Returns whether an entity type can belong to a workspace or not.
     *
     * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
     *   The entity type to check.
     *
     * @return bool
     *   TRUE if the entity type can belong to a workspace, FALSE otherwise.
     *
     * @deprecated in drupal:10.3.0 and is removed from drupal:11.0.0. Use
     *   \Drupal\workspaces\WorkspaceInformation::isEntityTypeSupported instead.
     *
     * @see https://www.drupal.org/node/3324297
     */
    public function isEntityTypeSupported(EntityTypeInterface $entity_type);
    
    /**
     * Returns an array of entity types that can belong to workspaces.
     *
     * @return \Drupal\Core\Entity\EntityTypeInterface[]
     *   The entity types what can belong to workspaces.
     *
     * @deprecated in drupal:10.3.0 and is removed from drupal:11.0.0. Use
     *   \Drupal\workspaces\WorkspaceInformation::getSupportedEntityTypes instead.
     *
     * @see https://www.drupal.org/node/3324297
     */
    public function getSupportedEntityTypes();
    
    /**
     * 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
     *   The active workspace entity object.
     */
    public function getActiveWorkspace();
    
    /**
     * Sets the active workspace via the workspace negotiators.
     *
     * @param \Drupal\workspaces\WorkspaceInterface $workspace
     *   The workspace to set as active.
     *
     * @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 via the workspace negotiators.
     *
     * @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);
    
    /**
     * Determines whether runtime entity operations should be altered.
     *
     * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
     *   The entity type to check.
     *
     * @return bool
     *   TRUE if the entity operations or queries should be altered in the current
     *   request, FALSE otherwise.
     *
     * @deprecated in drupal:10.3.0 and is removed from drupal:11.0.0. There is no
     *   replacement.
     *
     * @see https://www.drupal.org/node/3324297
     */
    public function shouldAlterOperations(EntityTypeInterface $entity_type);
    
    /**
     * Deletes the revisions associated with deleted workspaces.
     */
    public function purgeDeletedWorkspacesBatch();

}

Members

Title Sort descending Deprecated Modifiers Object type Summary
WorkspaceManagerInterface::executeInWorkspace public function Executes the given callback function in the context of a workspace.
WorkspaceManagerInterface::executeOutsideWorkspace public function Executes the given callback function without any workspace context.
WorkspaceManagerInterface::getActiveWorkspace public function Gets the active workspace.
WorkspaceManagerInterface::getSupportedEntityTypes Deprecated public function Returns an array of entity types that can belong to workspaces.
WorkspaceManagerInterface::hasActiveWorkspace public function Determines whether a workspace is active in the current request.
WorkspaceManagerInterface::isEntityTypeSupported Deprecated public function Returns whether an entity type can belong to a workspace or not.
WorkspaceManagerInterface::purgeDeletedWorkspacesBatch public function Deletes the revisions associated with deleted workspaces.
WorkspaceManagerInterface::setActiveWorkspace public function Sets the active workspace via the workspace negotiators.
WorkspaceManagerInterface::shouldAlterOperations Deprecated public function Determines whether runtime entity operations should be altered.
WorkspaceManagerInterface::switchToLive public function Unsets the active workspace via the workspace negotiators.

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