function DefaultHtmlRouteProvider::getRoutes

Same name in other branches
  1. 9 core/lib/Drupal/Core/Entity/Routing/DefaultHtmlRouteProvider.php \Drupal\Core\Entity\Routing\DefaultHtmlRouteProvider::getRoutes()
  2. 8.9.x core/lib/Drupal/Core/Entity/Routing/DefaultHtmlRouteProvider.php \Drupal\Core\Entity\Routing\DefaultHtmlRouteProvider::getRoutes()
  3. 11.x core/lib/Drupal/Core/Entity/Routing/DefaultHtmlRouteProvider.php \Drupal\Core\Entity\Routing\DefaultHtmlRouteProvider::getRoutes()

Overrides EntityRouteProviderInterface::getRoutes

1 method overrides DefaultHtmlRouteProvider::getRoutes()
VocabularyRouteProvider::getRoutes in core/modules/taxonomy/src/Entity/Routing/VocabularyRouteProvider.php
Provides routes for entities.

File

core/lib/Drupal/Core/Entity/Routing/DefaultHtmlRouteProvider.php, line 73

Class

DefaultHtmlRouteProvider
Provides HTML routes for entities.

Namespace

Drupal\Core\Entity\Routing

Code

public function getRoutes(EntityTypeInterface $entity_type) {
    $collection = new RouteCollection();
    $entity_type_id = $entity_type->id();
    if ($add_page_route = $this->getAddPageRoute($entity_type)) {
        $collection->add("entity.{$entity_type_id}.add_page", $add_page_route);
    }
    if ($add_form_route = $this->getAddFormRoute($entity_type)) {
        $collection->add("entity.{$entity_type_id}.add_form", $add_form_route);
    }
    if ($canonical_route = $this->getCanonicalRoute($entity_type)) {
        $collection->add("entity.{$entity_type_id}.canonical", $canonical_route);
    }
    if ($edit_route = $this->getEditFormRoute($entity_type)) {
        $collection->add("entity.{$entity_type_id}.edit_form", $edit_route);
    }
    if ($delete_route = $this->getDeleteFormRoute($entity_type)) {
        $collection->add("entity.{$entity_type_id}.delete_form", $delete_route);
    }
    if ($collection_route = $this->getCollectionRoute($entity_type)) {
        $collection->add("entity.{$entity_type_id}.collection", $collection_route);
    }
    if ($delete_multiple_route = $this->getDeleteMultipleFormRoute($entity_type)) {
        $collection->add('entity.' . $entity_type->id() . '.delete_multiple_form', $delete_multiple_route);
    }
    return $collection;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.