You are here

public function RouteSubscriber::alterRoutes in Comment IP 8

Alters existing routes for a specific collection.

Parameters

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

Overrides RouteSubscriberBase::alterRoutes

File

src/Routing/RouteSubscriber.php, line 16

Class

RouteSubscriber
Listens to the dynamic route events.

Namespace

Drupal\comment_ip\Routing

Code

public function alterRoutes(RouteCollection $collection) {

  // Change path '/user/login' to '/login'.
  if ($route = $collection
    ->get('comment.admin')) {
    $route
      ->setDefault('_controller', 'Drupal\\comment_ip\\Controller\\CommentIpAdminController::adminPage');
  }
  if ($route = $collection
    ->get('comment.admin_approval')) {
    $route
      ->setDefault('_controller', 'Drupal\\comment_ip\\Controller\\CommentIpAdminController::adminPage');
  }
}