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