class ApiDocHtmlRouteProvider in Apigee API Catalog 8
Same name and namespace in other branches
- 8.2 src/Entity/Routing/ApiDocHtmlRouteProvider.php \Drupal\apigee_api_catalog\Entity\Routing\ApiDocHtmlRouteProvider
 
Provides routes for API Doc entities.
Hierarchy
- class \Drupal\Core\Entity\Routing\DefaultHtmlRouteProvider implements EntityHandlerInterface, EntityRouteProviderInterface
- class \Drupal\Core\Entity\Routing\AdminHtmlRouteProvider
- class \Drupal\apigee_api_catalog\Entity\Routing\ApiDocHtmlRouteProvider uses StringTranslationTrait
 
 
 - class \Drupal\Core\Entity\Routing\AdminHtmlRouteProvider
 
Expanded class hierarchy of ApiDocHtmlRouteProvider
See also
\Drupal\Core\Entity\Routing\AdminHtmlRouteProvider
\Drupal\Core\Entity\Routing\DefaultHtmlRouteProvider
File
- src/
Entity/ Routing/ ApiDocHtmlRouteProvider.php, line 35  
Namespace
Drupal\apigee_api_catalog\Entity\RoutingView source
class ApiDocHtmlRouteProvider extends AdminHtmlRouteProvider {
  use StringTranslationTrait;
  /**
   * {@inheritdoc}
   */
  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;
  }
  /**
   * Gets the settings form route.
   *
   * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
   *   The entity type.
   *
   * @return \Symfony\Component\Routing\Route|null
   *   The generated route, if available.
   */
  protected function getSettingsFormRoute(EntityTypeInterface $entity_type) {
    if (!$entity_type
      ->getBundleEntityType()) {
      $route = new Route('admin/structure/apidoc');
      $route
        ->setDefaults([
        '_form' => 'Drupal\\apigee_api_catalog\\Entity\\Form\\ApiDocSettingsForm',
        '_title_callback' => ApiDocController::class . '::title',
      ])
        ->setRequirement('_permission', $entity_type
        ->getAdminPermission())
        ->setOption('_admin_route', TRUE);
      return $route;
    }
  }
  /**
   * Gets the reimport-spec-form route.
   *
   * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
   *   The entity type.
   *
   * @return \Symfony\Component\Routing\Route|null
   *   The generated route, if available.
   */
  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;
  }
}Members
| 
            Name | 
                  Modifiers | Type | Description | Overrides | 
|---|---|---|---|---|
| 
            AdminHtmlRouteProvider:: | 
                  protected | function | 
            Gets the add-form route. Overrides DefaultHtmlRouteProvider:: | 
                  |
| 
            AdminHtmlRouteProvider:: | 
                  protected | function | 
            Gets the add page route. Overrides DefaultHtmlRouteProvider:: | 
                  |
| 
            AdminHtmlRouteProvider:: | 
                  protected | function | 
            Gets the delete-form route. Overrides DefaultHtmlRouteProvider:: | 
                  |
| 
            AdminHtmlRouteProvider:: | 
                  protected | function | 
            Returns the delete multiple form route. Overrides DefaultHtmlRouteProvider:: | 
                  |
| 
            AdminHtmlRouteProvider:: | 
                  protected | function | 
            Gets the edit-form route. Overrides DefaultHtmlRouteProvider:: | 
                  1 | 
| 
            ApiDocHtmlRouteProvider:: | 
                  protected | function | Gets the reimport-spec-form route. | |
| 
            ApiDocHtmlRouteProvider:: | 
                  public | function | 
            Provides routes for entities. Overrides DefaultHtmlRouteProvider:: | 
                  |
| 
            ApiDocHtmlRouteProvider:: | 
                  protected | function | Gets the settings form route. | |
| 
            DefaultHtmlRouteProvider:: | 
                  protected | property | The entity field manager. | |
| 
            DefaultHtmlRouteProvider:: | 
                  protected | property | The entity type manager. | |
| 
            DefaultHtmlRouteProvider:: | 
                  public static | function | 
            Instantiates a new instance of this entity handler. Overrides EntityHandlerInterface:: | 
                  1 | 
| 
            DefaultHtmlRouteProvider:: | 
                  protected | function | Gets the canonical route. | 3 | 
| 
            DefaultHtmlRouteProvider:: | 
                  protected | function | Gets the collection route. | 2 | 
| 
            DefaultHtmlRouteProvider:: | 
                  protected | function | Gets the type of the ID key for a given entity type. | 1 | 
| 
            DefaultHtmlRouteProvider:: | 
                  public | function | Constructs a new DefaultHtmlRouteProvider. | 1 | 
| 
            StringTranslationTrait:: | 
                  protected | property | The string translation service. | 1 | 
| 
            StringTranslationTrait:: | 
                  protected | function | Formats a string containing a count of items. | |
| 
            StringTranslationTrait:: | 
                  protected | function | Returns the number of plurals supported by a given language. | |
| 
            StringTranslationTrait:: | 
                  protected | function | Gets the string translation service. | |
| 
            StringTranslationTrait:: | 
                  public | function | Sets the string translation service to use. | 2 | 
| 
            StringTranslationTrait:: | 
                  protected | function | Translates a string to the current language or to a given language. |