} /**
* Adds the active workspace as a cache key part to the route provider.
*
* @param \Symfony\Component\HttpKernel\Event\RequestEvent $event
* An event object.
*/
public function onKernelRequest(RequestEvent
$event) { if ($this->workspaceManager->
hasActiveWorkspace() &&
$this->routeProvider instanceof CacheableRouteProviderInterface
) { $this->routeProvider->
addExtraCacheKeyPart('workspace',
$this->workspaceManager->
getActiveWorkspace()->
id());
} } /**
* {@inheritdoc}
*/
public static function getSubscribedEvents(): array
{ // Use a priority of 190 in order to run after the generic core subscriber.
// @see \Drupal\Core\EventSubscriber\PathSubscriber::getSubscribedEvents()
$events[KernelEvents::CONTROLLER
][] =
['onKernelController', 190
];