class TestRouteSubscriber in Devel 8.3
Same name and namespace in other branches
- 8 tests/modules/devel_test/src/Routing/TestRouteSubscriber.php \Drupal\devel_test\Routing\TestRouteSubscriber
- 8.2 tests/modules/devel_test/src/Routing/TestRouteSubscriber.php \Drupal\devel_test\Routing\TestRouteSubscriber
- 4.x tests/modules/devel_test/src/Routing/TestRouteSubscriber.php \Drupal\devel_test\Routing\TestRouteSubscriber
Router subscriber class for testing purpose.
Hierarchy
- class \Drupal\Core\Routing\RouteSubscriberBase implements \Symfony\Component\EventDispatcher\EventSubscriberInterface
- class \Drupal\devel_test\Routing\TestRouteSubscriber
Expanded class hierarchy of TestRouteSubscriber
1 string reference to 'TestRouteSubscriber'
- devel_test.services.yml in tests/
modules/ devel_test/ devel_test.services.yml - tests/modules/devel_test/devel_test.services.yml
1 service uses TestRouteSubscriber
- devel_test.test_route_subscriber in tests/
modules/ devel_test/ devel_test.services.yml - Drupal\devel_test\Routing\TestRouteSubscriber
File
- tests/
modules/ devel_test/ src/ Routing/ TestRouteSubscriber.php, line 12
Namespace
Drupal\devel_test\RoutingView source
class TestRouteSubscriber extends RouteSubscriberBase {
/**
* The state store.
*
* @var Drupal\Core\State\State
*/
protected $state;
/**
* Constructor method.
*
* @param Drupal\Core\State\State $state
* The object State.
*/
public function __construct(State $state) {
$this->state = $state;
}
/**
* {@inheritdoc}
*/
protected function alterRoutes(RouteCollection $collection) {
$this->state
->set('devel_test_route_rebuild', 'Router rebuild fired');
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
RouteSubscriberBase:: |
public static | function | Returns an array of event names this subscriber wants to listen to. | 5 |
RouteSubscriberBase:: |
public | function | Delegates the route altering to self::alterRoutes(). | 1 |
TestRouteSubscriber:: |
protected | property | The state store. | |
TestRouteSubscriber:: |
protected | function |
Alters existing routes for a specific collection. Overrides RouteSubscriberBase:: |
|
TestRouteSubscriber:: |
public | function | Constructor method. |