You are here

class RouteSubscriber in Create user permission 8

Same name and namespace in other branches
  1. 2.x src/Routing/RouteSubscriber.php \Drupal\create_user_permission\Routing\RouteSubscriber

Class RouteSubscriber.

@package Drupal\create_user_permission\Routing Listens to the dynamic route events.

Hierarchy

  • class \Drupal\Core\Routing\RouteSubscriberBase implements \Symfony\Component\EventDispatcher\EventSubscriberInterface

Expanded class hierarchy of RouteSubscriber

1 string reference to 'RouteSubscriber'
create_user_permission.services.yml in ./create_user_permission.services.yml
create_user_permission.services.yml
1 service uses RouteSubscriber
create_user_permission.route_subscriber in ./create_user_permission.services.yml
Drupal\create_user_permission\Routing\RouteSubscriber

File

src/Routing/RouteSubscriber.php, line 14

Namespace

Drupal\create_user_permission\Routing
View source
class RouteSubscriber extends RouteSubscriberBase {

  /**
   * {@inheritdoc}
   */
  protected function alterRoutes(RouteCollection $collection) {
    if ($route = $collection
      ->get('user.admin_create')) {
      $route
        ->setRequirement('_permission', 'create users');
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
RouteSubscriber::alterRoutes protected function Alters existing routes for a specific collection. Overrides RouteSubscriberBase::alterRoutes
RouteSubscriberBase::getSubscribedEvents public static function Returns an array of event names this subscriber wants to listen to. 5
RouteSubscriberBase::onAlterRoutes public function Delegates the route altering to self::alterRoutes(). 1