"Fossies" - the Fresh Open Source Software Archive

Member "drupal-8.9.10/core/modules/workspaces/src/WorkspaceManagerInterface.php" (26 Nov 2020, 2873 Bytes) of package /linux/www/drupal-8.9.10.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PHP source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "WorkspaceManagerInterface.php" see the Fossies "Dox" file reference documentation.

    1 <?php
    2 
    3 namespace Drupal\workspaces;
    4 
    5 use Drupal\Core\Entity\EntityTypeInterface;
    6 
    7 /**
    8  * Provides an interface for managing Workspaces.
    9  */
   10 interface WorkspaceManagerInterface {
   11 
   12   /**
   13    * Returns whether an entity type can belong to a workspace or not.
   14    *
   15    * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
   16    *   The entity type to check.
   17    *
   18    * @return bool
   19    *   TRUE if the entity type can belong to a workspace, FALSE otherwise.
   20    */
   21   public function isEntityTypeSupported(EntityTypeInterface $entity_type);
   22 
   23   /**
   24    * Returns an array of entity types that can belong to workspaces.
   25    *
   26    * @return \Drupal\Core\Entity\EntityTypeInterface[]
   27    *   The entity types what can belong to workspaces.
   28    */
   29   public function getSupportedEntityTypes();
   30 
   31   /**
   32    * Determines whether a workspace is active in the current request.
   33    *
   34    * @return bool
   35    *   TRUE if a workspace is active, FALSE otherwise.
   36    */
   37   public function hasActiveWorkspace();
   38 
   39   /**
   40    * Gets the active workspace.
   41    *
   42    * @return \Drupal\workspaces\WorkspaceInterface
   43    *   The active workspace entity object.
   44    */
   45   public function getActiveWorkspace();
   46 
   47   /**
   48    * Sets the active workspace via the workspace negotiators.
   49    *
   50    * @param \Drupal\workspaces\WorkspaceInterface $workspace
   51    *   The workspace to set as active.
   52    *
   53    * @return $this
   54    *
   55    * @throws \Drupal\workspaces\WorkspaceAccessException
   56    *   Thrown when the current user doesn't have access to view the workspace.
   57    */
   58   public function setActiveWorkspace(WorkspaceInterface $workspace);
   59 
   60   /**
   61    * Unsets the active workspace via the workspace negotiators.
   62    *
   63    * @return $this
   64    */
   65   public function switchToLive();
   66 
   67   /**
   68    * Executes the given callback function in the context of a workspace.
   69    *
   70    * @param string $workspace_id
   71    *   The ID of a workspace.
   72    * @param callable $function
   73    *   The callback to be executed.
   74    *
   75    * @return mixed
   76    *   The callable's return value.
   77    */
   78   public function executeInWorkspace($workspace_id, callable $function);
   79 
   80   /**
   81    * Executes the given callback function without any workspace context.
   82    *
   83    * @param callable $function
   84    *   The callback to be executed.
   85    *
   86    * @return mixed
   87    *   The callable's return value.
   88    */
   89   public function executeOutsideWorkspace(callable $function);
   90 
   91   /**
   92    * Determines whether runtime entity operations should be altered.
   93    *
   94    * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
   95    *   The entity type to check.
   96    *
   97    * @return bool
   98    *   TRUE if the entity operations or queries should be altered in the current
   99    *   request, FALSE otherwise.
  100    */
  101   public function shouldAlterOperations(EntityTypeInterface $entity_type);
  102 
  103   /**
  104    * Deletes the revisions associated with deleted workspaces.
  105    */
  106   public function purgeDeletedWorkspacesBatch();
  107 
  108 }