protected function RouteSubscriber::alterRoutes in Config Entity Revisions 8.2
Same name in this branch
- 8.2 modules/contact_form_revisions/src/Routing/RouteSubscriber.php \Drupal\contact_form_revisions\Routing\RouteSubscriber::alterRoutes()
- 8.2 modules/webform_revisions/src/Routing/RouteSubscriber.php \Drupal\webform_revisions\Routing\RouteSubscriber::alterRoutes()
- 8.2 modules/view_revisions/src/Routing/RouteSubscriber.php \Drupal\view_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/
contact_form_revisions/ src/ Routing/ RouteSubscriber.php, line 18
Class
- RouteSubscriber
- Class RouteSubscriber.
Namespace
Drupal\contact_form_revisions\RoutingCode
protected function alterRoutes(RouteCollection $collection) {
$latest_revision_routes = [
'entity.contact_form.edit_form',
];
foreach ($latest_revision_routes as $route_name) {
if ($route = $collection
->get($route_name)) {
$current = $route
->getOption('parameters') ?: [];
$current['contact']['load_latest_revision'] = TRUE;
$route
->setOption('parameters', $current);
}
}
}