protected function RouteSubscriber::alterRoutes in Config Entity Revisions 1.x
Same name in this branch
- 1.x modules/webform_revisions/src/Routing/RouteSubscriber.php \Drupal\webform_revisions\Routing\RouteSubscriber::alterRoutes()
- 1.x modules/views_revisions/src/Routing/RouteSubscriber.php \Drupal\views_revisions\Routing\RouteSubscriber::alterRoutes()
Same name and namespace in other branches
- 8 modules/views_revisions/src/Routing/RouteSubscriber.php \Drupal\views_revisions\Routing\RouteSubscriber::alterRoutes()
Alters existing routes for a specific collection.
Parameters
\Symfony\Component\Routing\RouteCollection $collection: The route collection for adding routes.
Overrides RouteSubscriberBase::alterRoutes
File
- modules/
views_revisions/ src/ Routing/ RouteSubscriber.php, line 18
Class
- RouteSubscriber
- Class RouteSubscriber
Namespace
Drupal\views_revisions\RoutingCode
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);
}
}
}