class RouteSubscriber in Multiple Registration 8
Same name and namespace in other branches
- 8.2 src/Routing/RouteSubscriber.php \Drupal\multiple_registration\Routing\RouteSubscriber
- 3.x src/Routing/RouteSubscriber.php \Drupal\multiple_registration\Routing\RouteSubscriber
Listens to the dynamic route events.
Hierarchy
- class \Drupal\Core\Routing\RouteSubscriberBase implements \Symfony\Component\EventDispatcher\EventSubscriberInterface
- class \Drupal\multiple_registration\Routing\RouteSubscriber
Expanded class hierarchy of RouteSubscriber
1 string reference to 'RouteSubscriber'
1 service uses RouteSubscriber
File
- src/
Routing/ RouteSubscriber.php, line 13
Namespace
Drupal\multiple_registration\RoutingView source
class RouteSubscriber extends RouteSubscriberBase {
protected $configFactory;
/**
* Constructs a Drupal\multiple_registration\Routing\RouteSubscriber object.
*
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
* The factory for configuration objects.
*/
public function __construct(ConfigFactoryInterface $config_factory) {
$this->configFactory = $config_factory;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
return new static($container
->get('config.factory'));
}
/**
* Altering route for the user.register.
*/
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');
}
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
RouteSubscriber:: |
protected | property | ||
RouteSubscriber:: |
protected | function |
Altering route for the user.register. Overrides RouteSubscriberBase:: |
|
RouteSubscriber:: |
public static | function | ||
RouteSubscriber:: |
public | function | Constructs a Drupal\multiple_registration\Routing\RouteSubscriber object. | |
RouteSubscriberBase:: |
public static | function | Returns an array of event names this subscriber wants to listen to. | 5 |
RouteSubscriberBase:: |
public | function | Delegates the route altering to self::alterRoutes(). | 1 |