protected function RevisionRouteProvider::getRevisionViewRoute in Entity API 8.0
Same name and namespace in other branches
- 8 src/Routing/RevisionRouteProvider.php \Drupal\entity\Routing\RevisionRouteProvider::getRevisionViewRoute()
Gets the entity revision view route.
Parameters
\Drupal\Core\Entity\EntityTypeInterface $entity_type: The entity type.
Return value
\Symfony\Component\Routing\Route|null The generated route, if available.
1 call to RevisionRouteProvider::getRevisionViewRoute()
- RevisionRouteProvider::getRoutes in src/
Routing/ RevisionRouteProvider.php - Provides routes for entities.
File
- src/
Routing/ RevisionRouteProvider.php, line 49 - Contains \Drupal\entity\Routing\RevisionRouteProvider.
Class
- RevisionRouteProvider
- Provides revision routes.
Namespace
Drupal\entity\RoutingCode
protected function getRevisionViewRoute(EntityTypeInterface $entity_type) {
if ($entity_type
->hasLinkTemplate('revision')) {
$entity_type_id = $entity_type
->id();
$route = new Route($entity_type
->getLinkTemplate('revision'));
$route
->addDefaults([
'_controller' => '\\Drupal\\entity\\Controller\\RevisionController::view',
'_title_callback' => '\\Drupal\\Core\\Entity\\Controller\\EntityController::title',
]);
$route
->addRequirements([
'_entity_access_revision' => "{$entity_type_id}.view",
]);
$route
->setOption('parameters', [
$entity_type
->id() => [
'type' => 'entity:' . $entity_type
->id(),
],
$entity_type
->id() . '_revision' => [
'type' => 'entity_revision:' . $entity_type
->id(),
],
]);
return $route;
}
}