protected function RouteSubscriber::alterRoutes in Automatic Entity Label 8.2
Same name and namespace in other branches
- 8.3 src/Routing/RouteSubscriber.php \Drupal\auto_entitylabel\Routing\RouteSubscriber::alterRoutes()
- 8 src/Routing/RouteSubscriber.php \Drupal\auto_entitylabel\Routing\RouteSubscriber::alterRoutes()
Alters existing routes for a specific collection.
Parameters
\Symfony\Component\Routing\RouteCollection $collection: The route collection for adding routes.
Overrides RouteSubscriberBase::alterRoutes
File
- src/
Routing/ RouteSubscriber.php, line 37
Class
- RouteSubscriber
- Subscriber for auto_entitylabel routes.
Namespace
Drupal\auto_entitylabel\RoutingCode
protected function alterRoutes(RouteCollection $collection) {
foreach ($this->entityTypeManager
->getDefinitions() as $entity_type_id => $entity_type) {
if ($route = $this
->getEntityLabelRoute($entity_type)) {
$collection
->add("entity.{$entity_type_id}.auto_label", $route);
}
}
}