/** * Checks that an entity is an event type. */ public function access(Route $route, RouteMatchInterface $route_match, AccountInterface $account) { if ($event = $route->getDefault('event')) { $event = $route_match->getParameter($event); if ($event instanceof EntityInterface) { return AccessResult::allowedIf($this->eventManager->isEvent($event)); } } return AccessResult::neutral(); }