You are here

protected function RouteSubscriber::alterRoutes in Simple Password Reset 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\simple_pass_reset\Routing

Code

protected function alterRoutes(RouteCollection $collection) {

  // Alter user reset password page.
  $route = $collection
    ->get('user.reset');
  if ($route) {
    $route
      ->setDefaults([
      '_title' => 'Choose a new password',
      '_controller' => '\\Drupal\\simple_pass_reset\\Controller\\User::resetPass',
    ]);
    $route
      ->setRequirement('_custom_access', '\\Drupal\\simple_pass_reset\\AccessChecks\\ResetPassAccessCheck::access');
  }
}