class GroupAdminRouteSubscriber in Group 8
Same name and namespace in other branches
- 2.0.x src/Routing/GroupAdminRouteSubscriber.php \Drupal\group\Routing\GroupAdminRouteSubscriber
Sets the _admin_route for specific group-related routes.
Hierarchy
- class \Drupal\Core\Routing\RouteSubscriberBase implements \Symfony\Component\EventDispatcher\EventSubscriberInterface
- class \Drupal\group\Routing\GroupAdminRouteSubscriber
Expanded class hierarchy of GroupAdminRouteSubscriber
1 string reference to 'GroupAdminRouteSubscriber'
1 service uses GroupAdminRouteSubscriber
File
- src/
Routing/ GroupAdminRouteSubscriber.php, line 12
Namespace
Drupal\group\RoutingView source
class GroupAdminRouteSubscriber extends RouteSubscriberBase {
/**
* The config factory.
*
* @var \Drupal\Core\Config\ConfigFactoryInterface
*/
protected $configFactory;
/**
* Constructs a new GroupAdminRouteSubscriber.
*
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
* The config factory.
*/
public function __construct(ConfigFactoryInterface $config_factory) {
$this->configFactory = $config_factory;
}
/**
* {@inheritdoc}
*/
protected function alterRoutes(RouteCollection $collection) {
if ($this->configFactory
->get('group.settings')
->get('use_admin_theme')) {
foreach ($collection
->all() as $route) {
if ($route
->hasOption('_group_operation_route')) {
$route
->setOption('_admin_route', TRUE);
}
}
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
GroupAdminRouteSubscriber:: |
protected | property | The config factory. | |
GroupAdminRouteSubscriber:: |
protected | function |
Alters existing routes for a specific collection. Overrides RouteSubscriberBase:: |
|
GroupAdminRouteSubscriber:: |
public | function | Constructs a new GroupAdminRouteSubscriber. | |
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 |