class RouteSubscriberBase
Same name in other branches
- 9 core/lib/Drupal/Core/Routing/RouteSubscriberBase.php \Drupal\Core\Routing\RouteSubscriberBase
- 8.9.x core/lib/Drupal/Core/Routing/RouteSubscriberBase.php \Drupal\Core\Routing\RouteSubscriberBase
- 11.x core/lib/Drupal/Core/Routing/RouteSubscriberBase.php \Drupal\Core\Routing\RouteSubscriberBase
Provides a base implementation for RouteSubscriber.
Hierarchy
- class \Drupal\Core\Routing\RouteSubscriberBase implements \Symfony\Component\EventDispatcher\EventSubscriberInterface
Expanded class hierarchy of RouteSubscriberBase
18 files declare their use of RouteSubscriberBase
- AdminRouteSubscriber.php in core/
modules/ system/ src/ EventSubscriber/ AdminRouteSubscriber.php - ContentModerationRouteSubscriber.php in core/
modules/ content_moderation/ src/ Routing/ ContentModerationRouteSubscriber.php - ContentTranslationRouteSubscriber.php in core/
modules/ content_translation/ src/ Routing/ ContentTranslationRouteSubscriber.php - MenuLinksetRoutes.php in core/
modules/ system/ src/ Routing/ MenuLinksetRoutes.php - MigrateDrupalUiRouteSubscriber.php in core/
modules/ migrate_drupal_ui/ src/ Routing/ MigrateDrupalUiRouteSubscriber.php
File
-
core/
lib/ Drupal/ Core/ Routing/ RouteSubscriberBase.php, line 11
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() : array {
$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
Title Sort descending | Modifiers | Object type | Summary | Overrides |
---|---|---|---|---|
RouteSubscriberBase::alterRoutes | abstract protected | function | Alters existing routes for a specific collection. | 18 |
RouteSubscriberBase::getSubscribedEvents | public static | function | 10 | |
RouteSubscriberBase::onAlterRoutes | public | function | Delegates the route altering to self::alterRoutes(). | 1 |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.