function RouteSubscriber::alterRoutes

Alters existing routes for a specific collection.

Parameters

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

Overrides RouteSubscriberBase::alterRoutes

File

core/modules/serialization/tests/modules/user_route_alter_test/src/Routing/RouteSubscriber.php, line 19

Class

RouteSubscriber
Alter the 'user.pass.http' route.

Namespace

Drupal\user_route_alter_test\Routing

Code

protected function alterRoutes(RouteCollection $collection) : void {
  if ($route = $collection->get('user.pass.http')) {
    $route->setRequirements([]);
    $route->setRequirement('_access', 'FALSE');
  }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.