You are here

public function RouteSubscriber::beforePageManagerRoutes in Page Manager 8

Same name and namespace in other branches
  1. 8.4 tests/modules/page_manager_routing_test/src/Routing/RouteSubscriber.php \Drupal\page_manager_routing_test\Routing\RouteSubscriber::beforePageManagerRoutes()

Alters the existing route collection.

Parameters

\Drupal\Core\Routing\RouteBuildEvent $event: The route build event.

File

tests/modules/page_manager_routing_test/src/Routing/RouteSubscriber.php, line 21

Class

RouteSubscriber
Route subscriber for Page Manager Routing Test.

Namespace

Drupal\page_manager_routing_test\Routing

Code

public function beforePageManagerRoutes(RouteBuildEvent $event) {
  $collection = $event
    ->getRouteCollection();
  $route = new Route('/entity_test/{entity_test}', [], [
    '_access' => 'TRUE',
  ]);
  $route
    ->setRequirement('_format', 'xml');
  $collection
    ->add('entity.entity_test.canonical.xml', $route);
}