You are here

class AppRouteProvider in Apigee Edge 8

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

Hierarchy

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\Entity
View 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;
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
AppRouteProvider::getAnalyticsRoute protected function Gets the analytics route.
AppRouteProvider::getRoutes public function Provides routes for entities. Overrides DefaultHtmlRouteProvider::getRoutes 2
DefaultHtmlRouteProvider::$entityFieldManager protected property The entity field manager.
DefaultHtmlRouteProvider::$entityTypeManager protected property The entity type manager.
DefaultHtmlRouteProvider::createInstance public static function Instantiates a new instance of this entity handler. Overrides EntityHandlerInterface::createInstance 1
DefaultHtmlRouteProvider::getAddFormRoute protected function Gets the add-form route. 2
DefaultHtmlRouteProvider::getAddPageRoute protected function Gets the add page route. 2
DefaultHtmlRouteProvider::getCollectionRoute protected function Gets the collection route. 2
DefaultHtmlRouteProvider::getDeleteMultipleFormRoute protected function Returns the delete multiple form route. 1
DefaultHtmlRouteProvider::getEntityTypeIdKeyType protected function Gets the type of the ID key for a given entity type. 1
DefaultHtmlRouteProvider::__construct public function Constructs a new DefaultHtmlRouteProvider. 1
EdgeEntityRouteProvider::getCanonicalRoute protected function Gets the canonical route. Overrides DefaultHtmlRouteProvider::getCanonicalRoute 1
EdgeEntityRouteProvider::getDeleteFormRoute protected function Gets the delete-form route. Overrides DefaultHtmlRouteProvider::getDeleteFormRoute
EdgeEntityRouteProvider::getEditFormRoute protected function Gets the edit-form route. Overrides DefaultHtmlRouteProvider::getEditFormRoute