function WorkspaceManager::__construct
Same name in other branches
- 9 core/modules/workspaces/src/WorkspaceManager.php \Drupal\workspaces\WorkspaceManager::__construct()
- 8.9.x core/modules/workspaces/src/WorkspaceManager.php \Drupal\workspaces\WorkspaceManager::__construct()
- 11.x core/modules/workspaces/src/WorkspaceManager.php \Drupal\workspaces\WorkspaceManager::__construct()
Constructs a new WorkspaceManager.
Parameters
\Symfony\Component\HttpFoundation\RequestStack $request_stack: The request stack.
\Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager: The entity type manager.
\Drupal\Core\Cache\MemoryCache\MemoryCacheInterface $entity_memory_cache: The entity memory cache service.
\Drupal\Core\Session\AccountProxyInterface $current_user: The current user.
\Drupal\Core\State\StateInterface $state: The state service.
\Psr\Log\LoggerInterface $logger: A logger instance.
\Drupal\Core\DependencyInjection\ClassResolverInterface $class_resolver: The class resolver.
\Drupal\workspaces\WorkspaceAssociationInterface $workspace_association: The workspace association service.
\Drupal\workspaces\WorkspaceInformationInterface|null $workspace_information: The workspace information service.
array|null $negotiator_ids: The workspace negotiator service IDs.
File
-
core/
modules/ workspaces/ src/ WorkspaceManager.php, line 124
Class
- WorkspaceManager
- Provides the workspace manager.
Namespace
Drupal\workspacesCode
public function __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, ?WorkspaceInformationInterface $workspace_information = NULL, ?array $negotiator_ids = NULL) {
$this->requestStack = $request_stack;
$this->entityTypeManager = $entity_type_manager;
$this->entityMemoryCache = $entity_memory_cache;
$this->currentUser = $current_user;
$this->state = $state;
$this->logger = $logger;
$this->classResolver = $class_resolver;
$this->workspaceAssociation = $workspace_association;
if (!$workspace_information instanceof WorkspaceInformationInterface) {
@trigger_error('Calling ' . __METHOD__ . '() without the $workspace_information argument is deprecated in drupal:10.3.0 and will be required in drupal:11.0.0. See https://www.drupal.org/node/3324297', E_USER_DEPRECATED);
$this->workspaceInfo = \Drupal::service('workspaces.information');
// The negotiator IDs are always the last constructor argument.
$this->negotiatorIds = $workspace_information;
}
else {
$this->workspaceInfo = $workspace_information;
$this->negotiatorIds = $negotiator_ids;
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.