You are here

protected function DefaultRouteSubscriber::enhanceDefaultAddRoutes in Form mode manager 8

Enhance entity operation routes add.

Parameters

\Symfony\Component\Routing\RouteCollection $collection: The route collection to retrieve parent entity routes.

string $entity_type_id: The ID of the entity type.

1 call to DefaultRouteSubscriber::enhanceDefaultAddRoutes()
DefaultRouteSubscriber::enhanceDefaultRoutes in src/Routing/EventSubscriber/DefaultRouteSubscriber.php
Enhance existing entity operation routes (add_page, add_form, edit_form).

File

src/Routing/EventSubscriber/DefaultRouteSubscriber.php, line 102

Class

DefaultRouteSubscriber
Subscriber for form_mode_manager routes.

Namespace

Drupal\form_mode_manager\Routing\EventSubscriber

Code

protected function enhanceDefaultAddRoutes(RouteCollection $collection, $entity_type_id) {
  $entity_route_name = $this->entityRoutingMap
    ->createInstance($entity_type_id, [
    'entityTypeId' => $entity_type_id,
  ])
    ->getOperation('add_form');
  if ($route = $collection
    ->get($entity_route_name)) {
    $collection
      ->add($entity_route_name, $this
      ->routeEnhancer($route, $entity_type_id));
  }
}