class GroupRevisionRouteSubscriber in Group 8
Same name and namespace in other branches
- 2.0.x src/Entity/Routing/GroupRevisionRouteSubscriber.php \Drupal\group\Entity\Routing\GroupRevisionRouteSubscriber
Swaps out the revision UI access callbacks.
Hierarchy
- class \Drupal\Core\Routing\RouteSubscriberBase implements \Symfony\Component\EventDispatcher\EventSubscriberInterface
- class \Drupal\group\Entity\Routing\GroupRevisionRouteSubscriber
Expanded class hierarchy of GroupRevisionRouteSubscriber
1 string reference to 'GroupRevisionRouteSubscriber'
1 service uses GroupRevisionRouteSubscriber
File
- src/
Entity/ Routing/ GroupRevisionRouteSubscriber.php, line 11
Namespace
Drupal\group\Entity\RoutingView source
class GroupRevisionRouteSubscriber extends RouteSubscriberBase {
/**
* {@inheritdoc}
*/
protected function alterRoutes(RouteCollection $collection) {
if ($route = $collection
->get('entity.group.revision')) {
$requirements = $route
->getRequirements();
unset($requirements['_entity_access_revision']);
$requirements['_group_revision'] = 'view';
$route
->setRequirements($requirements);
$route
->setOption('_group_operation_route', TRUE);
}
if ($route = $collection
->get('entity.group.revision_revert_form')) {
$requirements = $route
->getRequirements();
unset($requirements['_entity_access_revision']);
$requirements['_group_revision'] = 'update';
$route
->setRequirements($requirements);
$route
->setDefault('_form', '\\Drupal\\group\\Entity\\Form\\GroupRevisionRevertForm');
$route
->setOption('_group_operation_route', TRUE);
}
if ($route = $collection
->get('entity.group.version_history')) {
$requirements = $route
->getRequirements();
unset($requirements['_entity_access_revision']);
$requirements['_group_revision'] = 'list';
$route
->setRequirements($requirements);
$route
->setDefault('_controller', '\\Drupal\\group\\Entity\\Controller\\GroupRevisionOverviewController::revisionOverviewController');
$route
->setOption('_group_operation_route', TRUE);
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
GroupRevisionRouteSubscriber:: |
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 |