You are here

public function AccessTokenRouteProvider::getRoutes in Access unpublished 8

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

src/Routing/AccessTokenRouteProvider.php, line 19

Class

AccessTokenRouteProvider
Contains routs for access tokens.

Namespace

Drupal\access_unpublished\Routing

Code

public function getRoutes(EntityTypeInterface $entity_type) {
  $collection = new RouteCollection();
  $entity_type_id = $entity_type
    ->id();
  if ($add_page_route = $this
    ->getRenewRoute($entity_type)) {
    $collection
      ->add("entity.{$entity_type_id}.renew", $add_page_route);
  }
  if ($add_page_route = $this
    ->getDeleteRoute($entity_type)) {
    $collection
      ->add("entity.{$entity_type_id}.delete", $add_page_route);
  }
  return $collection;
}