You are here

public function ApiDocHtmlRouteProvider::getRoutes in Apigee API Catalog 8

Same name and namespace in other branches
  1. 8.2 src/Entity/Routing/ApiDocHtmlRouteProvider.php \Drupal\apigee_api_catalog\Entity\Routing\ApiDocHtmlRouteProvider::getRoutes()

Provides routes for entities.

Parameters

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

Return value

\Symfony\Component\Routing\RouteCollection|\Symfony\Component\Routing\Route[] Returns a route collection or an array of routes keyed by name, like route_callbacks inside 'routing.yml' files.

Overrides DefaultHtmlRouteProvider::getRoutes

File

src/Entity/Routing/ApiDocHtmlRouteProvider.php, line 42

Class

ApiDocHtmlRouteProvider
Provides routes for API Doc entities.

Namespace

Drupal\apigee_api_catalog\Entity\Routing

Code

public function getRoutes(EntityTypeInterface $entity_type) {
  $collection = parent::getRoutes($entity_type);
  if ($settings_form_route = $this
    ->getSettingsFormRoute($entity_type)) {
    $collection
      ->add('entity.apidoc.settings', $settings_form_route);
  }
  if ($apidoc_collection_route = $collection
    ->get('entity.apidoc.collection')) {
    $apidoc_collection_route
      ->setDefault('_title', $this
      ->t('@entity_type catalog', [
      '@entity_type' => $entity_type
        ->getLabel(),
    ])
      ->render());
  }
  if ($reimport_spec_route = $this
    ->getReimportSpecFormRoute($entity_type)) {
    $collection
      ->add("entity.apidoc.reimport_spec_form", $reimport_spec_route);
  }
  return $collection;
}