You are here

protected function DefaultRouteSubscriber::enhanceDefaultAddPageRoutes in Form mode manager 8

Enhance entity operation routes add_page.

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::enhanceDefaultAddPageRoutes()
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 87

Class

DefaultRouteSubscriber
Subscriber for form_mode_manager routes.

Namespace

Drupal\form_mode_manager\Routing\EventSubscriber

Code

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