function RouteSubscriber::alterRoutes

Alters existing routes for a specific collection.

Parameters

\Symfony\Component\Routing\RouteCollection $collection: The route collection for adding routes.

Overrides RouteSubscriberBase::alterRoutes

File

core/modules/block_content/src/Routing/RouteSubscriber.php, line 76

Class

RouteSubscriber
Subscriber for Block content BC routes.

Namespace

Drupal\block_content\Routing

Code

protected function alterRoutes(RouteCollection $collection) {
  $this->collection = $collection;
  // @see block_content.routing.yml
  if ($this->setUpBaseRoute('entity.block_content_type.collection')) {
    $this->addRedirectRoute('block_content.type_add');
  }
  $entity_type = $this->entityTypeManager
    ->getDefinition('block_content');
  if ($this->setUpBaseRoute($entity_type->get('field_ui_base_route'))) {
    foreach ($this->childRoutes($entity_type) as $route_name) {
      $this->addRedirectRoute($route_name);
    }
  }
}

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