function RevisionHtmlRouteProvider::getRevisionRevertRoute
Same name in other branches
- 10 core/lib/Drupal/Core/Entity/Routing/RevisionHtmlRouteProvider.php \Drupal\Core\Entity\Routing\RevisionHtmlRouteProvider::getRevisionRevertRoute()
Gets the entity revision revert route.
Parameters
\Drupal\Core\Entity\EntityTypeInterface $entityType: The entity type.
Return value
\Symfony\Component\Routing\Route|null The entity revision revert route, or NULL if the entity type does not support reverting revisions.
1 call to RevisionHtmlRouteProvider::getRevisionRevertRoute()
- RevisionHtmlRouteProvider::getRoutes in core/
lib/ Drupal/ Core/ Entity/ Routing/ RevisionHtmlRouteProvider.php
File
-
core/
lib/ Drupal/ Core/ Entity/ Routing/ RevisionHtmlRouteProvider.php, line 116
Class
- RevisionHtmlRouteProvider
- Provides entity revision routes.
Namespace
Drupal\Core\Entity\RoutingCode
protected function getRevisionRevertRoute(EntityTypeInterface $entityType) : ?Route {
if (!$entityType->hasLinkTemplate('revision-revert-form')) {
return NULL;
}
$entityTypeId = $entityType->id();
$revisionParameterName = $entityTypeId . '_revision';
return (new Route($entityType->getLinkTemplate('revision-revert-form')))
->addDefaults([
'_entity_form' => $entityTypeId . '.revision-revert',
'_title' => 'Revert revision',
])
->setRequirement('_entity_access', $revisionParameterName . '.revert')
->setOption('_admin_route', TRUE)
->setOption('parameters', [
$entityTypeId => [
'type' => 'entity:' . $entityTypeId,
],
$revisionParameterName => [
'type' => 'entity_revision:' . $entityTypeId,
],
]);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.