protected function RouteSubscriber::alterRoutes in Create user permission 2.x
Same name and namespace in other branches
- 8 src/Routing/RouteSubscriber.php \Drupal\create_user_permission\Routing\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
- src/
Routing/ RouteSubscriber.php, line 19
Class
- RouteSubscriber
- Class RouteSubscriber.
Namespace
Drupal\create_user_permission\RoutingCode
protected function alterRoutes(RouteCollection $collection) {
if ($route = $collection
->get('user.admin_create')) {
$route
->setRequirement('_permission', 'create users');
}
}