public function RevisionRouteProvider::getRoutes in Entity API 8.0
Same name and namespace in other branches
- 8 src/Routing/RevisionRouteProvider.php \Drupal\entity\Routing\RevisionRouteProvider::getRoutes()
Provides routes for entities.
Parameters
\Drupal\Core\Entity\EntityTypeInterface $entity_type: The entity type
Return value
\Symfony\Component\Routing\RouteCollection|\Symfony\Component\Routing\Route[] Returns a route collection or an array of routes keyed by name, like route_callbacks inside 'routing.yml' files.
Overrides EntityRouteProviderInterface::getRoutes
File
- src/
Routing/ RevisionRouteProvider.php, line 23 - Contains \Drupal\entity\Routing\RevisionRouteProvider.
Class
- RevisionRouteProvider
- Provides revision routes.
Namespace
Drupal\entity\RoutingCode
public function getRoutes(EntityTypeInterface $entity_type) {
$collection = new RouteCollection();
$entity_type_id = $entity_type
->id();
if ($view_route = $this
->getRevisionViewRoute($entity_type)) {
$collection
->add("entity.{$entity_type_id}.revision", $view_route);
}
if ($view_route = $this
->getRevisionRevertRoute($entity_type)) {
$collection
->add("entity.{$entity_type_id}.revision_revert_form", $view_route);
}
if ($view_route = $this
->getRevisionHistoryRoute($entity_type)) {
$collection
->add("entity.{$entity_type_id}.version_history", $view_route);
}
return $collection;
}