You are here

class GroupRevisionRouteSubscriber in Group 8

Same name and namespace in other branches
  1. 2.0.x src/Entity/Routing/GroupRevisionRouteSubscriber.php \Drupal\group\Entity\Routing\GroupRevisionRouteSubscriber

Swaps out the revision UI access callbacks.

Hierarchy

Expanded class hierarchy of GroupRevisionRouteSubscriber

1 string reference to 'GroupRevisionRouteSubscriber'
group.services.yml in ./group.services.yml
group.services.yml
1 service uses GroupRevisionRouteSubscriber
group.revision.route_subscriber in ./group.services.yml
Drupal\group\Entity\Routing\GroupRevisionRouteSubscriber

File

src/Entity/Routing/GroupRevisionRouteSubscriber.php, line 11

Namespace

Drupal\group\Entity\Routing
View 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

Namesort descending Modifiers Type Description Overrides
GroupRevisionRouteSubscriber::alterRoutes protected function Alters existing routes for a specific collection. Overrides RouteSubscriberBase::alterRoutes
RouteSubscriberBase::getSubscribedEvents public static function Returns an array of event names this subscriber wants to listen to. 5
RouteSubscriberBase::onAlterRoutes public function Delegates the route altering to self::alterRoutes(). 1