class RouteTestSubscriber in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/system/tests/modules/router_test_directory/src/RouteTestSubscriber.php \Drupal\router_test\RouteTestSubscriber
Listens to the dynamic route event and add a test route.
Hierarchy
- class \Drupal\Core\Routing\RouteSubscriberBase implements EventSubscriberInterface
- class \Drupal\router_test\RouteTestSubscriber
Expanded class hierarchy of RouteTestSubscriber
File
- core/
modules/ system/ tests/ modules/ router_test_directory/ src/ RouteTestSubscriber.php, line 16 - Contains \Drupal\router_test\RouteTestSubscriber.
Namespace
Drupal\router_testView source
class RouteTestSubscriber extends RouteSubscriberBase {
/**
* {@inheritdoc}
*/
protected function alterRoutes(RouteCollection $collection) {
$route = $collection
->get('router_test.6');
// Change controller method from test1 to test5.
$route
->setDefault('_controller', '\\Drupal\\router_test\\TestControllers::test5');
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
RouteSubscriberBase:: |
public static | function |
Returns an array of event names this subscriber wants to listen to. Overrides EventSubscriberInterface:: |
5 |
RouteSubscriberBase:: |
public | function | Delegates the route altering to self::alterRoutes(). | 1 |
RouteTestSubscriber:: |
protected | function |
Alters existing routes for a specific collection. Overrides RouteSubscriberBase:: |