class WorkspaceSwitchEvent
Defines the workspace switch event.
Hierarchy
- class \Drupal\Component\EventDispatcher\Event extends \Symfony\Contracts\EventDispatcher\Event
- class \Drupal\workspaces\Event\WorkspaceSwitchEvent extends \Drupal\Component\EventDispatcher\Event
Expanded class hierarchy of WorkspaceSwitchEvent
2 files declare their use of WorkspaceSwitchEvent
- WorkspaceManager.php in core/
modules/ workspaces/ src/ WorkspaceManager.php - WorkspaceSwitchSubscriber.php in core/
modules/ workspaces/ src/ EventSubscriber/ WorkspaceSwitchSubscriber.php
File
-
core/
modules/ workspaces/ src/ Event/ WorkspaceSwitchEvent.php, line 11
Namespace
Drupal\workspaces\EventView source
class WorkspaceSwitchEvent extends Event {
public function __construct(protected readonly ?WorkspaceInterface $workspace = NULL, protected readonly ?WorkspaceInterface $previousWorkspace = NULL) {
}
/**
* Gets the new activate workspace.
*
* @return \Drupal\workspaces\WorkspaceInterface|null
* A workspace entity, or NULL if we switched into Live.
*/
public function getWorkspace() : ?WorkspaceInterface {
return $this->workspace;
}
/**
* Gets the previous active workspace.
*
* @return \Drupal\workspaces\WorkspaceInterface|null
* A workspace entity, or NULL if we switched from Live.
*/
public function getPreviousWorkspace() : ?WorkspaceInterface {
return $this->previousWorkspace;
}
}
Members
| Title Sort descending | Modifiers | Object type | Summary |
|---|---|---|---|
| WorkspaceSwitchEvent::getPreviousWorkspace | public | function | Gets the previous active workspace. |
| WorkspaceSwitchEvent::getWorkspace | public | function | Gets the new activate workspace. |
| WorkspaceSwitchEvent::__construct | public | function |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.