function RevisionHtmlRouteProvider::getRoutes

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

Provides routes for entities.

Parameters

\Drupal\Core\Entity\EntityTypeInterface $entity_type: The entity type

Return value

\Symfony\Component\Routing\RouteCollection|\Symfony\Component\Routing\Route[] Returns a route collection or an array of routes keyed by name, like route_callbacks inside 'routing.yml' files.

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.