class RouteSubscriber in Config Entity Revisions 8
Same name in this branch
- 8 modules/webform_revisions/src/Routing/RouteSubscriber.php \Drupal\webform_revisions\Routing\RouteSubscriber
- 8 modules/views_revisions/src/Routing/RouteSubscriber.php \Drupal\views_revisions\Routing\RouteSubscriber
Same name and namespace in other branches
- 1.x modules/views_revisions/src/Routing/RouteSubscriber.php \Drupal\views_revisions\Routing\RouteSubscriber
Class RouteSubscriber
@package Drupal\views_revisions\Routing
Hierarchy
- class \Drupal\Core\Routing\RouteSubscriberBase implements \Symfony\Component\EventDispatcher\EventSubscriberInterface
- class \Drupal\views_revisions\Routing\RouteSubscriber
Expanded class hierarchy of RouteSubscriber
1 string reference to 'RouteSubscriber'
- views_revisions.services.yml in modules/
views_revisions/ views_revisions.services.yml - modules/views_revisions/views_revisions.services.yml
1 service uses RouteSubscriber
- views_revisions.route_subscriber in modules/
views_revisions/ views_revisions.services.yml - Drupal\views_revisions\Routing\RouteSubscriber
File
- modules/
views_revisions/ src/ Routing/ RouteSubscriber.php, line 13
Namespace
Drupal\views_revisions\RoutingView source
class RouteSubscriber extends RouteSubscriberBase {
/**
* {@inheritdoc}
*/
protected function alterRoutes(RouteCollection $collection) {
$latest_revision_routes = [
'entity.views.source_form',
'entity.views.edit_form',
'entity.views_ui.element.edit_form',
];
foreach ($latest_revision_routes as $route_name) {
if ($route = $collection
->get($route_name)) {
$current = $route
->getOption('parameters') ?: [];
$current['views']['load_latest_revision'] = TRUE;
$route
->setOption('parameters', $current);
}
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
RouteSubscriber:: |
protected | function |
Alters existing routes for a specific collection. Overrides RouteSubscriberBase:: |
|
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 |