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.2 modules/webform_revisions/src/Routing/RouteSubscriber.php \Drupal\webform_revisions\Routing\RouteSubscriber::alterRoutes()
- 8 modules/webform_revisions/src/Routing/RouteSubscriber.php \Drupal\webform_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/
webform_revisions/ src/ Routing/ RouteSubscriber.php, line 18
Class
- RouteSubscriber
- Class RouteSubscriber
Namespace
Drupal\webform_revisions\RoutingCode
protected function alterRoutes(RouteCollection $collection) {
$latest_revision_routes = [
'entity.webform.source_form',
'entity.webform.edit_form',
'entity.webform_ui.element',
'entity.webform_ui.change_element',
'entity.webform_ui.element.add_form',
'entity.webform_ui.element.add_page',
'entity.webform_ui.element.add_layout',
'entity.webform_ui.element.edit_form',
'entity.webform_ui.element.delete_form',
'entity.webform_ui.element.duplicate_form',
'entity.webform_ui.element.test_form',
];
foreach ($latest_revision_routes as $route_name) {
if ($route = $collection
->get($route_name)) {
$current = $route
->getOption('parameters') ?: [];
$current['webform']['load_latest_revision'] = TRUE;
$route
->setOption('parameters', $current);
}
}
}