Change record status: 
Project: 
Introduced in branch: 
11.3.x
Introduced in version: 
11.3.0
Description: 

A new WorkspaceSwitchEvent event has been added, which provides the ability to react when the active workspaces changes, either on switching from Live to a workspace or the other way around.

Code example

class WorkspaceSwitchSubscriber implements EventSubscriberInterface {

  public function onWorkspaceSwitch(WorkspaceSwitchEvent $event): void {
    // Clear a custom static cache entry.
  }

  public static function getSubscribedEvents(): array {
    $events[WorkspaceSwitchEvent::class][] = 'onWorkspaceSwitch';

    return $events;
  }

}
Impacts: 
Module developers