You are here

protected function ApiDocHtmlRouteProvider::getReimportSpecFormRoute 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::getReimportSpecFormRoute()

Gets the reimport-spec-form 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 ApiDocHtmlRouteProvider::getReimportSpecFormRoute()
ApiDocHtmlRouteProvider::getRoutes in src/Entity/Routing/ApiDocHtmlRouteProvider.php
Provides routes for entities.

File

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

Class

ApiDocHtmlRouteProvider
Provides routes for API Doc entities.

Namespace

Drupal\apigee_api_catalog\Entity\Routing

Code

protected function getReimportSpecFormRoute(EntityTypeInterface $entity_type) {
  $route = new Route($entity_type
    ->getLinkTemplate('reimport-spec-form'));
  $route
    ->setDefaults([
    '_entity_form' => "apidoc.reimport_spec",
    '_title' => 'Re-import API Doc OpenAPI specification',
  ])
    ->setRequirement('_entity_access', "apidoc.reimport")
    ->setOption('parameters', [
    'apidoc' => [
      'type' => 'entity:apidoc',
    ],
  ]);

  // Entity types with serial IDs can specify this in their route
  // requirements, improving the matching process.
  if ($this
    ->getEntityTypeIdKeyType($entity_type) === 'integer') {
    $route
      ->setRequirement('apidoc', '\\d+');
  }
  return $route;
}