class NodeRevisionRouteSubscriber in Multiversion 8
Alters entity.node.revision route.
Hierarchy
- class \Drupal\Core\Routing\RouteSubscriberBase implements \Symfony\Component\EventDispatcher\EventSubscriberInterface
- class \Drupal\multiversion\EventSubscriber\NodeRevisionRouteSubscriber
Expanded class hierarchy of NodeRevisionRouteSubscriber
1 string reference to 'NodeRevisionRouteSubscriber'
1 service uses NodeRevisionRouteSubscriber
File
- src/
EventSubscriber/ NodeRevisionRouteSubscriber.php, line 15
Namespace
Drupal\multiversion\EventSubscriberView source
class NodeRevisionRouteSubscriber extends RouteSubscriberBase {
/**
* Alters existing route.
*
* @param \Symfony\Component\Routing\RouteCollection $collection
* The route collection for adding routes.
*/
protected function alterRoutes(RouteCollection $collection) {
// When Diff module is installed we don't need to use
// MultiversionNodeController::revisionOverview, because we alter the
// 'revision_overview_form' for in that case.
// @see multiversion_form_revision_overview_form_alter().
if (!\Drupal::moduleHandler()
->moduleExists('diff')) {
if ($route = $collection
->get('entity.node.version_history')) {
$route
->setDefault('_controller', MultiversionNodeController::class . '::revisionOverview');
}
}
if ($route = $collection
->get('node.revision_revert_confirm')) {
$route
->setDefault('_form', MultiversionRevisionRevertForm::class);
}
if ($route = $collection
->get('node.revision_revert_translation_confirm')) {
$route
->setDefault('_form', MultiversionRevisionRevertTranslationForm::class);
}
}
/**
* {@inheritdoc}
*/
public static function getSubscribedEvents() {
$events = parent::getSubscribedEvents();
$events[RoutingEvents::ALTER] = array(
'onAlterRoutes',
-500,
);
return $events;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
NodeRevisionRouteSubscriber:: |
protected | function |
Alters existing route. Overrides RouteSubscriberBase:: |
|
NodeRevisionRouteSubscriber:: |
public static | function |
Returns an array of event names this subscriber wants to listen to. Overrides RouteSubscriberBase:: |
|
RouteSubscriberBase:: |
public | function | Delegates the route altering to self::alterRoutes(). | 1 |