protected function RouteSubscriber::alterRoutes in Multiple Registration 8
Same name and namespace in other branches
- 8.2 src/Routing/RouteSubscriber.php \Drupal\multiple_registration\Routing\RouteSubscriber::alterRoutes()
- 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 39
Class
- RouteSubscriber
- Listens to the dynamic route events.
Namespace
Drupal\multiple_registration\RoutingCode
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');
}
}
}