WorkspaceManager
class WorkspaceManager implements WorkspaceManagerInterface (View source)
Provides the workspace manager.
Traits
Wrapper methods for \Drupal\Core\StringTranslation\TranslationInterface.
Properties
| protected TranslationInterface | $stringTranslation | The string translation service. |
from StringTranslationTrait |
| protected string[] | $blacklist | An array of entity type IDs that can not belong to a workspace. |
|
| protected RequestStack | $requestStack | The request stack. |
|
| protected EntityTypeManagerInterface | $entityTypeManager | The entity type manager. |
|
| protected MemoryCacheInterface | $entityMemoryCache | The entity memory cache service. |
|
| protected AccountProxyInterface | $currentUser | The current user. |
|
| protected StateInterface | $state | The state service. |
|
| protected LoggerInterface | $logger | A logger instance. |
|
| protected ClassResolverInterface | $classResolver | The class resolver. |
|
| protected WorkspaceAssociationInterface | $workspaceAssociation | The workspace association service. |
|
| protected array | $negotiatorIds | The workspace negotiator service IDs. |
|
| protected WorkspaceInterface|false | $activeWorkspace | The current active workspace or FALSE if there is no active workspace. |
Methods
Translates a string to the current language or to a given language.
Formats a string containing a count of items.
Returns the number of plurals supported by a given language.
Gets the string translation service.
Constructs a new WorkspaceManager.
Returns whether an entity type can belong to a workspace or not.
Returns an array of entity types that can belong to workspaces.
Determines whether a workspace is active in the current request.
Gets the active workspace.
Sets the active workspace via the workspace negotiators.
Unsets the active workspace via the workspace negotiators.
Executes the given callback function in the context of a workspace.
Executes the given callback function without any workspace context.
Determines whether runtime entity operations should be altered.
Deletes the revisions associated with deleted workspaces.
Details
protected TranslatableMarkup
t(string $string, array $args = [], array $options = [])
Translates a string to the current language or to a given language.
See \Drupal\Core\StringTranslation\TranslatableMarkup::__construct() for important security information and usage guidelines.
In order for strings to be localized, make them available in one of the ways supported by the
protected
formatPlural($count, $singular, $plural, array $args = [], array $options = [])
Formats a string containing a count of items.
protected
getNumberOfPlurals($langcode = NULL)
Returns the number of plurals supported by a given language.
protected TranslationInterface
getStringTranslation()
Gets the string translation service.
$this
setStringTranslation(TranslationInterface $translation)
Sets the string translation service to use.
__construct(RequestStack $request_stack, EntityTypeManagerInterface $entity_type_manager, MemoryCacheInterface $entity_memory_cache, AccountProxyInterface $current_user, StateInterface $state, LoggerInterface $logger, ClassResolverInterface $class_resolver, WorkspaceAssociationInterface $workspace_association, array $negotiator_ids)
Constructs a new WorkspaceManager.
bool
isEntityTypeSupported(EntityTypeInterface $entity_type)
Returns whether an entity type can belong to a workspace or not.
EntityTypeInterface[]
getSupportedEntityTypes()
Returns an array of entity types that can belong to workspaces.
bool
hasActiveWorkspace()
Determines whether a workspace is active in the current request.
WorkspaceInterface
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.
protected
doSwitchWorkspace(WorkspaceInterface|null $workspace)
Switches the current workspace.
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.