You are here

public function TeamAppRouteProvider::getRoutes in Apigee Edge 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 AppRouteProvider::getRoutes

File

modules/apigee_edge_teams/src/Entity/TeamAppRouteProvider.php, line 43

Class

TeamAppRouteProvider
Default entity routes for team apps.

Namespace

Drupal\apigee_edge_teams\Entity

Code

public function getRoutes(EntityTypeInterface $entity_type) {
  $collection = parent::getRoutes($entity_type);
  $entity_type_id = $entity_type
    ->id();

  /** @var \Symfony\Component\Routing\Route $route */
  foreach ($collection as $route) {
    $this
      ->alterRoutesWithAppName($route);
  }
  if ($add_form_for_team = $this
    ->getAddFormRouteForTeam($entity_type)) {
    $collection
      ->add("entity.{$entity_type_id}.add_form_for_team", $add_form_for_team);
  }
  if ($collection_by_team = $this
    ->getCollectionRouteByTeam($entity_type)) {
    $collection
      ->add("entity.{$entity_type_id}.collection_by_team", $collection_by_team);
  }
  if ($api_keys = $this
    ->getTeamApiKeysRoute($entity_type)) {
    $collection
      ->add("entity.{$entity_type_id}.api_keys", $api_keys);
  }
  if ($add_api_key_form = $this
    ->getAddApiKeyRoute($entity_type)) {
    $collection
      ->add("entity.{$entity_type_id}.add_api_key_form", $add_api_key_form);
  }
  if ($delete_api_key_form = $this
    ->getDeleteApiKeyRoute($entity_type)) {
    $collection
      ->add("entity.{$entity_type_id}.delete_api_key_form", $delete_api_key_form);
  }
  if ($revoke_api_key_form = $this
    ->getRevokeApiKeyRoute($entity_type)) {
    $collection
      ->add("entity.{$entity_type_id}.revoke_api_key_form", $revoke_api_key_form);
  }
  return $collection;
}