You are here

protected function SocialGroupRequestRouteSubscriber::alterRoutes in Open Social 10.0.x

Same name and namespace in other branches
  1. 8.9 modules/social_features/social_group/modules/social_group_request/src/Routing/SocialGroupRequestRouteSubscriber.php \Drupal\social_group_request\Routing\SocialGroupRequestRouteSubscriber::alterRoutes()
  2. 10.3.x modules/social_features/social_group/modules/social_group_request/src/Routing/SocialGroupRequestRouteSubscriber.php \Drupal\social_group_request\Routing\SocialGroupRequestRouteSubscriber::alterRoutes()
  3. 10.1.x modules/social_features/social_group/modules/social_group_request/src/Routing/SocialGroupRequestRouteSubscriber.php \Drupal\social_group_request\Routing\SocialGroupRequestRouteSubscriber::alterRoutes()
  4. 10.2.x modules/social_features/social_group/modules/social_group_request/src/Routing/SocialGroupRequestRouteSubscriber.php \Drupal\social_group_request\Routing\SocialGroupRequestRouteSubscriber::alterRoutes()

Alters existing routes for a specific collection.

Parameters

\Symfony\Component\Routing\RouteCollection $collection: The route collection for adding routes.

Overrides RouteSubscriberBase::alterRoutes

File

modules/social_features/social_group/modules/social_group_request/src/Routing/SocialGroupRequestRouteSubscriber.php, line 18

Class

SocialGroupRequestRouteSubscriber
Class SocialGroupRequestRouteSubscriber.

Namespace

Drupal\social_group_request\Routing

Code

protected function alterRoutes(RouteCollection $collection) {
  if ($route = $collection
    ->get('grequest.request_membership')) {
    $route
      ->setDefaults([
      '_controller' => GroupRequestController::class . '::requestMembership',
    ]);
  }
  if ($route = $collection
    ->get('grequest.group_request_membership_approve')) {
    $route
      ->setDefaults([
      '_title_callback' => GroupRequestController::class . '::getTitleApproveRequest',
      '_controller' => GroupRequestController::class . '::approveRequest',
    ]);
  }
  if ($route = $collection
    ->get('grequest.group_request_membership_reject')) {
    $route
      ->setDefaults([
      '_title_callback' => GroupRequestController::class . '::getTitleRejectRequest',
      '_form' => GroupRequestMembershipRejectForm::class,
    ]);
  }
  if ($route = $collection
    ->get('view.group_pending_members.page_1')) {
    $route
      ->setRequirements([
      '_custom_access' => GroupRequestController::class . '::routeAccess',
    ]);
  }
  if ($route = $collection
    ->get('view.group_pending_members.membership_requests')) {
    $route
      ->setRequirements([
      '_custom_access' => GroupRequestController::class . '::routeAccess',
    ]);
  }
}