You are here

protected function AppRouteProvider::getAnalyticsRoute in Apigee Edge 8

Gets the analytics route.

Parameters

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

Return value

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

1 call to AppRouteProvider::getAnalyticsRoute()
AppRouteProvider::getRoutes in src/Entity/AppRouteProvider.php
Provides routes for entities.

File

src/Entity/AppRouteProvider.php, line 54

Class

AppRouteProvider
Developer- and company (team) app specific route overrides and additions.

Namespace

Drupal\apigee_edge\Entity

Code

protected function getAnalyticsRoute(EntityTypeInterface $entity_type) {
  if ($entity_type
    ->hasLinkTemplate('analytics') && $entity_type
    ->hasHandlerClass('form', 'analytics')) {
    $entity_type_id = $entity_type
      ->id();
    $route = new Route($entity_type
      ->getLinkTemplate('analytics'));
    $route
      ->setDefault('_form', $entity_type
      ->getFormClass('analytics'));
    $route
      ->setDefault('_title_callback', AppTitleProvider::class . '::analyticsTitle');
    $route
      ->setDefault('entity_type_id', $entity_type_id);
    $route
      ->setRequirement('_entity_access', "{$entity_type_id}.analytics");

    // This is required because we are not using _entity_form.
    $route
      ->setOption('parameters', [
      $entity_type_id => [
        'type' => 'entity:' . $entity_type_id,
      ],
    ]);
    return $route;
  }
}