You are here

protected function RouteSubscriber::alterRoutes in Multiple Registration 8.2

Same name and namespace in other branches
  1. 8 src/Routing/RouteSubscriber.php \Drupal\multiple_registration\Routing\RouteSubscriber::alterRoutes()
  2. 3.x src/Routing/RouteSubscriber.php \Drupal\multiple_registration\Routing\RouteSubscriber::alterRoutes()

Altering route for the user.register.

Overrides RouteSubscriberBase::alterRoutes

File

src/Routing/RouteSubscriber.php, line 44

Class

RouteSubscriber
Listens to the dynamic route events.

Namespace

Drupal\multiple_registration\Routing

Code

protected function alterRoutes(RouteCollection $collection) {

  // Access denied to '/user/register' when corresponded option is enabled.
  if ($route = $collection
    ->get('user.register')) {
    $disableMain = $this->configFactory
      ->get('multiple_registration.common_settings_page_form_config')
      ->get('multiple_registration_disable_main');
    if ($disableMain === 1) {
      $route
        ->setRequirement('_access', 'FALSE');
    }
  }
}