abstract class RouteSubscriberBase in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/lib/Drupal/Core/Routing/RouteSubscriberBase.php \Drupal\Core\Routing\RouteSubscriberBase
Provides a base implementation for RouteSubscriber.
Hierarchy
- class \Drupal\Core\Routing\RouteSubscriberBase implements EventSubscriberInterface
Expanded class hierarchy of RouteSubscriberBase
11 files declare their use of RouteSubscriberBase
- AdminRouteSubscriber.php in core/
modules/ system/ src/ EventSubscriber/ AdminRouteSubscriber.php - Contains \Drupal\system\EventSubscriber\AdminRouteSubscriber.
- ContentTranslationRouteSubscriber.php in core/
modules/ content_translation/ src/ Routing/ ContentTranslationRouteSubscriber.php - Contains \Drupal\content_translation\Routing\ContentTranslationRouteSubscriber.
- ModuleRouteSubscriber.php in core/
lib/ Drupal/ Core/ EventSubscriber/ ModuleRouteSubscriber.php - Contains \Drupal\Core\EventSubscriber\ModuleRouteSubscriber.
- NodeAdminRouteSubscriber.php in core/
modules/ node/ src/ EventSubscriber/ NodeAdminRouteSubscriber.php - Contains \Drupal\node\EventSubscriber\NodeAdminRouteSubscriber.
- ResourceRoutes.php in core/
modules/ rest/ src/ Routing/ ResourceRoutes.php - Contains \Drupal\rest\Routing\ResourceRoutes.
File
- core/
lib/ Drupal/ Core/ Routing/ RouteSubscriberBase.php, line 16 - Contains \Drupal\Core\Routing\RouteSubscriberBase.
Namespace
Drupal\Core\RoutingView source
abstract class RouteSubscriberBase implements EventSubscriberInterface {
/**
* Alters existing routes for a specific collection.
*
* @param \Symfony\Component\Routing\RouteCollection $collection
* The route collection for adding routes.
*/
protected abstract function alterRoutes(RouteCollection $collection);
/**
* {@inheritdoc}
*/
public static function getSubscribedEvents() {
$events[RoutingEvents::ALTER] = 'onAlterRoutes';
return $events;
}
/**
* Delegates the route altering to self::alterRoutes().
*
* @param \Drupal\Core\Routing\RouteBuildEvent $event
* The route build event.
*/
public function onAlterRoutes(RouteBuildEvent $event) {
$collection = $event
->getRouteCollection();
$this
->alterRoutes($collection);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
RouteSubscriberBase:: |
abstract protected | function | Alters existing routes for a specific collection. | 11 |
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 |