function RevisionHtmlRouteProvider::getRevisionDeleteRoute
Same name in other branches
- 10 core/lib/Drupal/Core/Entity/Routing/RevisionHtmlRouteProvider.php \Drupal\Core\Entity\Routing\RevisionHtmlRouteProvider::getRevisionDeleteRoute()
Gets the entity revision delete route.
Parameters
\Drupal\Core\Entity\EntityTypeInterface $entityType: The entity type.
Return value
\Symfony\Component\Routing\Route|null The entity revision delete route, or NULL if the entity type does not support deleting revisions.
1 call to RevisionHtmlRouteProvider::getRevisionDeleteRoute()
- RevisionHtmlRouteProvider::getRoutes in core/
lib/ Drupal/ Core/ Entity/ Routing/ RevisionHtmlRouteProvider.php - Provides routes for entities.
File
-
core/
lib/ Drupal/ Core/ Entity/ Routing/ RevisionHtmlRouteProvider.php, line 150
Class
- RevisionHtmlRouteProvider
- Provides entity revision routes.
Namespace
Drupal\Core\Entity\RoutingCode
protected function getRevisionDeleteRoute(EntityTypeInterface $entityType) : ?Route {
if (!$entityType->hasLinkTemplate('revision-delete-form')) {
return NULL;
}
$entityTypeId = $entityType->id();
$revisionParameterName = $entityTypeId . '_revision';
return (new Route($entityType->getLinkTemplate('revision-delete-form')))
->addDefaults([
'_entity_form' => $entityTypeId . '.revision-delete',
'_title' => 'Delete revision',
])
->setRequirement('_entity_access', $revisionParameterName . '.delete revision')
->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.