class RouteSubscriber 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
- 8.2 modules/webform_revisions/src/Routing/RouteSubscriber.php \Drupal\webform_revisions\Routing\RouteSubscriber
- 8.2 modules/view_revisions/src/Routing/RouteSubscriber.php \Drupal\view_revisions\Routing\RouteSubscriber
Same name and namespace in other branches
- 8 modules/webform_revisions/src/Routing/RouteSubscriber.php \Drupal\webform_revisions\Routing\RouteSubscriber
- 1.x modules/webform_revisions/src/Routing/RouteSubscriber.php \Drupal\webform_revisions\Routing\RouteSubscriber
Class RouteSubscriber.
@package Drupal\webform_revisions\Routing
Hierarchy
- class \Drupal\Core\Routing\RouteSubscriberBase implements \Symfony\Component\EventDispatcher\EventSubscriberInterface
- class \Drupal\webform_revisions\Routing\RouteSubscriber
Expanded class hierarchy of RouteSubscriber
1 string reference to 'RouteSubscriber'
- webform_revisions.services.yml in modules/
webform_revisions/ webform_revisions.services.yml - modules/webform_revisions/webform_revisions.services.yml
1 service uses RouteSubscriber
- webform_revisions.route_subscriber in modules/
webform_revisions/ webform_revisions.services.yml - Drupal\webform_revisions\Routing\RouteSubscriber
File
- modules/
webform_revisions/ src/ Routing/ RouteSubscriber.php, line 13
Namespace
Drupal\webform_revisions\RoutingView source
class RouteSubscriber extends RouteSubscriberBase {
/**
* {@inheritdoc}
*/
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);
}
}
}
}
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 |