function RevisionHtmlRouteProvider::getRoutes

Same name in other branches
  1. 10 core/lib/Drupal/Core/Entity/Routing/RevisionHtmlRouteProvider.php \Drupal\Core\Entity\Routing\RevisionHtmlRouteProvider::getRoutes()

Overrides EntityRouteProviderInterface::getRoutes

File

core/lib/Drupal/Core/Entity/Routing/RevisionHtmlRouteProvider.php, line 19

Class

RevisionHtmlRouteProvider
Provides entity revision routes.

Namespace

Drupal\Core\Entity\Routing

Code

public function getRoutes(EntityTypeInterface $entity_type) {
    $collection = new RouteCollection();
    $entityTypeId = $entity_type->id();
    if ($version_history_route = $this->getVersionHistoryRoute($entity_type)) {
        $collection->add("entity.{$entityTypeId}.version_history", $version_history_route);
    }
    if ($revision_view_route = $this->getRevisionViewRoute($entity_type)) {
        $collection->add("entity.{$entityTypeId}.revision", $revision_view_route);
    }
    if ($revision_revert_route = $this->getRevisionRevertRoute($entity_type)) {
        $collection->add("entity.{$entityTypeId}.revision_revert_form", $revision_revert_route);
    }
    if ($revision_delete_route = $this->getRevisionDeleteRoute($entity_type)) {
        $collection->add("entity.{$entityTypeId}.revision_delete_form", $revision_delete_route);
    }
    return $collection;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.