You are here

protected function TeamRouteProvider::getCollectionRoute in Apigee Edge 8

Gets the collection route.

Parameters

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

Return value

\Symfony\Component\Routing\Route|null The generated route, if available.

Overrides DefaultHtmlRouteProvider::getCollectionRoute

File

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

Class

TeamRouteProvider
Team specific dynamic entity route provider.

Namespace

Drupal\apigee_edge_teams\Entity

Code

protected function getCollectionRoute(EntityTypeInterface $entity_type) {
  $route = parent::getCollectionRoute($entity_type);
  if ($route) {

    // Allows to easily display something else than the entity's plural
    // label on the team listing page, ex.: "Manage teams".
    $route
      ->setDefault('_title_callback', 'apigee_edge_teams_team_listing_page_title');
    $requirements = $route
      ->getRequirements();

    // We handle access to teams in the team list builder so "administer team"
    // default permission based restriction can be also removed.
    unset($requirements['_permission']);
    $requirements['_user_is_logged_in'] = 'TRUE';
    $route
      ->setRequirements($requirements);
  }
  return $route;
}