protected function RouteSubscriber::alterRoutes in Create user permission 8
Same name and namespace in other branches
- 2.x 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');
}
}