You are here

private function TeamAppRouteProvider::alterRoutesWithAppName in Apigee Edge 8

Alters routers with {app} and not {team_app}.

Parameters

\Symfony\Component\Routing\Route $route: Route object.

1 call to TeamAppRouteProvider::alterRoutesWithAppName()
TeamAppRouteProvider::getRoutes in modules/apigee_edge_teams/src/Entity/TeamAppRouteProvider.php
Provides routes for entities.

File

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

Class

TeamAppRouteProvider
Default entity routes for team apps.

Namespace

Drupal\apigee_edge_teams\Entity

Code

private function alterRoutesWithAppName(Route $route) : void {
  if (strpos($route
    ->getPath(), '{app}') !== FALSE) {

    // "team_app" parameter must be removed otherwise it cause
    // MissingMandatoryParametersException exceptions.
    $options = $route
      ->getOptions();
    unset($options['parameters']['team_app']);
    $route
      ->setOptions($options);

    // Default access check must be replaced.
    // @see \Drupal\apigee_edge\Access\AppAccessCheckByAppName
    $requirements = $route
      ->getRequirements();
    list(, $operation) = explode('.', $requirements['_entity_access']);
    $requirements['_app_access_check_by_app_name'] = $operation;
    unset($requirements['_entity_access']);
    $route
      ->setRequirements($requirements);
  }
}