You are here

protected function RouteSubscriber::createRoutesFromEventSubscribers in Organic groups 8

Add all the OG admin items to the route collection.

Parameters

string $og_admin_path: The OG admin path.

string $entity_type_id: The entity type ID.

\Symfony\Component\Routing\RouteCollection $collection: The route collection object.

1 call to RouteSubscriber::createRoutesFromEventSubscribers()
RouteSubscriber::alterRoutes in src/Routing/RouteSubscriber.php
Alters existing routes for a specific collection.

File

src/Routing/RouteSubscriber.php, line 118

Class

RouteSubscriber
Route subscriber for OG related routes.

Namespace

Drupal\og\Routing

Code

protected function createRoutesFromEventSubscribers($og_admin_path, $entity_type_id, RouteCollection $collection) {
  $event = new OgAdminRoutesEvent();
  $this->eventDispatcher
    ->dispatch(OgAdminRoutesEventInterface::EVENT_NAME, $event);
  foreach ($event
    ->getRoutes($entity_type_id) as $name => $route_info) {

    // Add the parent route.
    $parent_route_name = "entity.{$entity_type_id}.og_admin_routes.{$name}";
    $parent_path = $og_admin_path . '/' . $route_info['path'];
    $this
      ->addRoute($collection, $parent_route_name, $parent_path, $route_info);
  }
}