Version 1
[yaffs-website] / web / core / modules / system / tests / modules / router_test_directory / src / RouteTestSubscriber.php
1 <?php
2
3 namespace Drupal\router_test;
4
5 use Drupal\Core\Routing\RouteSubscriberBase;
6 use Symfony\Component\Routing\RouteCollection;
7
8 /**
9  * Listens to the dynamic route event and add a test route.
10  */
11 class RouteTestSubscriber extends RouteSubscriberBase {
12
13   /**
14    * {@inheritdoc}
15    */
16   protected function alterRoutes(RouteCollection $collection) {
17     $route = $collection->get('router_test.6');
18     // Change controller method from test1 to test5.
19     $route->setDefault('_controller', '\Drupal\router_test\TestControllers::test5');
20   }
21
22 }