final class TeamContextSwitcherRouteAlterSubscriber in Apigee Edge 8
Adds the _apigee_team_route option to developer (user) routes.
Hierarchy
- class \Drupal\Core\Routing\RouteSubscriberBase implements \Symfony\Component\EventDispatcher\EventSubscriberInterface
- class \Drupal\apigee_edge_teams\Routing\TeamContextSwitcherRouteAlterSubscriber
Expanded class hierarchy of TeamContextSwitcherRouteAlterSubscriber
See also
\Drupal\apigee_edge_teams\TeamContextManager::getCorrespondingRouteNameForEntity()
1 string reference to 'TeamContextSwitcherRouteAlterSubscriber'
- apigee_edge_teams.services.yml in modules/
apigee_edge_teams/ apigee_edge_teams.services.yml - modules/apigee_edge_teams/apigee_edge_teams.services.yml
1 service uses TeamContextSwitcherRouteAlterSubscriber
File
- modules/
apigee_edge_teams/ src/ Routing/ TeamContextSwitcherRouteAlterSubscriber.php, line 32
Namespace
Drupal\apigee_edge_teams\RoutingView source
final class TeamContextSwitcherRouteAlterSubscriber extends RouteSubscriberBase {
/**
* {@inheritdoc}
*/
protected function alterRoutes(RouteCollection $collection) {
foreach ($collection as $id => $route) {
// Add a corresponding team route if the team route defines a
// corresponding developer route.
if (($developer_route_id = $route
->getOption(TeamContextManagerInterface::DEVELOPER_ROUTE_OPTION_NAME)) && ($developer_route = $collection
->get($developer_route_id)) && empty($developer_route
->getOption(TeamContextManagerInterface::TEAM_ROUTE_OPTION_NAME))) {
$developer_route
->setOption(TeamContextManagerInterface::TEAM_ROUTE_OPTION_NAME, $id);
}
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
RouteSubscriberBase:: |
public static | function | Returns an array of event names this subscriber wants to listen to. | 5 |
RouteSubscriberBase:: |
public | function | Delegates the route altering to self::alterRoutes(). | 1 |
TeamContextSwitcherRouteAlterSubscriber:: |
protected | function |
Alters existing routes for a specific collection. Overrides RouteSubscriberBase:: |