interface WorkspaceManagerInterface (View source)

Provides an interface for managing Workspaces.

Methods

bool
isEntityTypeSupported(EntityTypeInterface $entity_type)

Returns whether an entity type can belong to a workspace or not.

getSupportedEntityTypes()

Returns an array of entity types that can belong to workspaces.

bool
hasActiveWorkspace()

Determines whether a workspace is active in the current request.

getActiveWorkspace()

Gets the active workspace.

$this
setActiveWorkspace(WorkspaceInterface $workspace)

Sets the active workspace via the workspace negotiators.

$this
switchToLive()

Unsets the active workspace via the workspace negotiators.

mixed
executeInWorkspace(string $workspace_id, callable $function)

Executes the given callback function in the context of a workspace.

mixed
executeOutsideWorkspace(callable $function)

Executes the given callback function without any workspace context.

bool
shouldAlterOperations(EntityTypeInterface $entity_type)

Determines whether runtime entity operations should be altered.

purgeDeletedWorkspacesBatch()

Deletes the revisions associated with deleted workspaces.

Details

bool isEntityTypeSupported(EntityTypeInterface $entity_type)

Returns whether an entity type can belong to a workspace or not.

Parameters

EntityTypeInterface $entity_type

The entity type to check.

Return Value

bool

TRUE if the entity type can belong to a workspace, FALSE otherwise.

EntityTypeInterface[] getSupportedEntityTypes()

Returns an array of entity types that can belong to workspaces.

Return Value

EntityTypeInterface[]

The entity types what can belong to workspaces.

bool hasActiveWorkspace()

Determines whether a workspace is active in the current request.

Return Value

bool

TRUE if a workspace is active, FALSE otherwise.

WorkspaceInterface getActiveWorkspace()

Gets the active workspace.

Return Value

WorkspaceInterface

The active workspace entity object.

$this setActiveWorkspace(WorkspaceInterface $workspace)

Sets the active workspace via the workspace negotiators.

Parameters

WorkspaceInterface $workspace

The workspace to set as active.

Return Value

$this

Exceptions

WorkspaceAccessException

$this switchToLive()

Unsets the active workspace via the workspace negotiators.

Return Value

$this

mixed executeInWorkspace(string $workspace_id, callable $function)

Executes the given callback function in the context of a workspace.

Parameters

string $workspace_id

The ID of a workspace.

callable $function

The callback to be executed.

Return Value

mixed

The callable's return value.

mixed executeOutsideWorkspace(callable $function)

Executes the given callback function without any workspace context.

Parameters

callable $function

The callback to be executed.

Return Value

mixed

The callable's return value.

bool shouldAlterOperations(EntityTypeInterface $entity_type)

Determines whether runtime entity operations should be altered.

Parameters

EntityTypeInterface $entity_type

The entity type to check.

Return Value

bool

TRUE if the entity operations or queries should be altered in the current request, FALSE otherwise.

purgeDeletedWorkspacesBatch()

Deletes the revisions associated with deleted workspaces.