RouteSubscriber.php in Create user permission 8
Same filename and directory in other branches
Namespace
Drupal\create_user_permission\RoutingFile
src/Routing/RouteSubscriber.phpView source
<?php
namespace Drupal\create_user_permission\Routing;
use Drupal\Core\Routing\RouteSubscriberBase;
use Symfony\Component\Routing\RouteCollection;
/**
* Class RouteSubscriber.
*
* @package Drupal\create_user_permission\Routing
* Listens to the dynamic route events.
*/
class RouteSubscriber extends RouteSubscriberBase {
/**
* {@inheritdoc}
*/
protected function alterRoutes(RouteCollection $collection) {
if ($route = $collection
->get('user.admin_create')) {
$route
->setRequirement('_permission', 'create users');
}
}
}
Classes
Name | Description |
---|---|
RouteSubscriber | Class RouteSubscriber. |