You are here

public function TeamRouteProvider::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 DefaultHtmlRouteProvider::getRoutes

File

modules/apigee_edge_teams/src/Entity/TeamRouteProvider.php, line 42

Class

TeamRouteProvider
Team specific dynamic entity route provider.

Namespace

Drupal\apigee_edge_teams\Entity

Code

public function getRoutes(EntityTypeInterface $entity_type) {
  $collection = parent::getRoutes($entity_type);
  $entity_type_id = $entity_type
    ->id();
  if ($list_team_members = $this
    ->getListTeamMembersRoute($entity_type)) {
    $collection
      ->add("entity.{$entity_type_id}.members", $list_team_members);
  }
  if ($add_team_members = $this
    ->getAddTeamMembersRoute($entity_type)) {
    $collection
      ->add("entity.{$entity_type_id}.add_members", $add_team_members);
  }
  if ($edit_team_member = $this
    ->getEditTeamMemberRoute($entity_type)) {
    $collection
      ->add("entity.{$entity_type_id}.member.edit", $edit_team_member);
  }
  if ($remove_team_member = $this
    ->getRemoveTeamMemberRoute($entity_type)) {
    $collection
      ->add("entity.{$entity_type_id}.member.remove", $remove_team_member);
  }
  return $collection;
}