protected function RevisionRouteProvider::getRevisionRevertRoute in Entity API 8
Same name and namespace in other branches
- 8.0 src/Routing/RevisionRouteProvider.php \Drupal\entity\Routing\RevisionRouteProvider::getRevisionRevertRoute()
Gets the entity revision revert 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::getRevisionRevertRoute()
- RevisionRouteProvider::getRoutes in src/
Routing/ RevisionRouteProvider.php - Provides routes for entities.
File
- src/
Routing/ RevisionRouteProvider.php, line 76
Class
- RevisionRouteProvider
- Provides revision routes.
Namespace
Drupal\entity\RoutingCode
protected function getRevisionRevertRoute(EntityTypeInterface $entity_type) {
if ($entity_type
->hasLinkTemplate('revision-revert-form')) {
$entity_type_id = $entity_type
->id();
$route = new Route($entity_type
->getLinkTemplate('revision-revert-form'));
$route
->addDefaults([
'_form' => '\\Drupal\\entity\\Form\\RevisionRevertForm',
'title' => 'Revert to earlier revision',
]);
$route
->addRequirements([
'_entity_access_revision' => "{$entity_type_id}.update",
]);
$route
->setOption('parameters', [
$entity_type
->id() => [
'type' => 'entity:' . $entity_type
->id(),
],
$entity_type
->id() . '_revision' => [
'type' => 'entity_revision:' . $entity_type
->id(),
],
]);
return $route;
}
}