class AppRouteProvider in Apigee Edge 8
Developer- and company (team) app specific route overrides and additions.
Hierarchy
- class \Drupal\Core\Entity\Routing\DefaultHtmlRouteProvider implements EntityHandlerInterface, EntityRouteProviderInterface
- class \Drupal\apigee_edge\Entity\EdgeEntityRouteProvider
- class \Drupal\apigee_edge\Entity\AppRouteProvider
- class \Drupal\apigee_edge\Entity\EdgeEntityRouteProvider
Expanded class hierarchy of AppRouteProvider
1 file declares its use of AppRouteProvider
- TeamAppRouteProvider.php in modules/
apigee_edge_teams/ src/ Entity/ TeamAppRouteProvider.php
File
- src/
Entity/ AppRouteProvider.php, line 29
Namespace
Drupal\apigee_edge\EntityView source
class AppRouteProvider extends EdgeEntityRouteProvider {
/**
* {@inheritdoc}
*/
public function getRoutes(EntityTypeInterface $entity_type) {
$collection = parent::getRoutes($entity_type);
$entity_type_id = $entity_type
->id();
if ($analytics_route = $this
->getAnalyticsRoute($entity_type)) {
$collection
->add("entity.{$entity_type_id}.analytics", $analytics_route);
}
return $collection;
}
/**
* Gets the analytics route.
*
* @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
* The entity type.
*
* @return \Symfony\Component\Routing\Route|null
* The generated route, if available.
*/
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;
}
}
}