class RouteTestSubscriber
Same name in other branches
- 9 core/modules/system/tests/modules/router_test_directory/src/RouteTestSubscriber.php \Drupal\router_test\RouteTestSubscriber
- 10 core/modules/system/tests/modules/router_test_directory/src/RouteTestSubscriber.php \Drupal\router_test\RouteTestSubscriber
- 11.x 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 \Symfony\Component\EventDispatcher\EventSubscriberInterface
- class \Drupal\router_test\RouteTestSubscriber extends \Drupal\Core\Routing\RouteSubscriberBase
Expanded class hierarchy of RouteTestSubscriber
File
-
core/
modules/ system/ tests/ modules/ router_test_directory/ src/ RouteTestSubscriber.php, line 11
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
Title Sort descending | Modifiers | Object type | Summary | Overriden Title | Overrides |
---|---|---|---|---|---|
RouteSubscriberBase::getSubscribedEvents | public static | function | 7 | ||
RouteSubscriberBase::onAlterRoutes | public | function | Delegates the route altering to self::alterRoutes(). | 1 | |
RouteTestSubscriber::alterRoutes | protected | function | Alters existing routes for a specific collection. | Overrides RouteSubscriberBase::alterRoutes |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.