You are here

trait TeamRoutingHelperTrait in Apigee Edge 8

Contains utility methods for team and team app routes.

Hierarchy

File

modules/apigee_edge_teams/src/Entity/TeamRoutingHelperTrait.php, line 28

Namespace

Drupal\apigee_edge_teams\Entity
View source
trait TeamRoutingHelperTrait {

  /**
   * If route contains the {team} parameter add required changes to the route.
   *
   * @param \Symfony\Component\Routing\Route $route
   *   The route to be checked and altered if needed.
   */
  private function ensureTeamParameter(Route $route) {
    if (strpos($route
      ->getPath(), '{team}') !== FALSE) {

      // Make sure the parameter gets up-casted.
      // (This also ensures that we get an "Page not found" page if user with
      // uid does not exist.)
      $route
        ->setOption('parameters', [
        'team' => [
          'type' => 'entity:team',
          'converter' => 'paramconverter.entity',
        ],
      ]);
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
TeamRoutingHelperTrait::ensureTeamParameter private function If route contains the {team} parameter add required changes to the route.