class LogAdminRouteSubscriber in Log entity 8
Sets the _admin_route for specific log-related routes.
Hierarchy
- class \Drupal\Core\Routing\RouteSubscriberBase implements \Symfony\Component\EventDispatcher\EventSubscriberInterface
- class \Drupal\log\EventSubscriber\LogAdminRouteSubscriber
Expanded class hierarchy of LogAdminRouteSubscriber
1 string reference to 'LogAdminRouteSubscriber'
1 service uses LogAdminRouteSubscriber
File
- src/
EventSubscriber/ LogAdminRouteSubscriber.php, line 17 - Contains \Drupal\log\EventSubscriber\LogAdminRouteSubscriber.
Namespace
Drupal\log\EventSubscriberView source
class LogAdminRouteSubscriber extends RouteSubscriberBase {
/**
* The config factory.
*
* @var \Drupal\Core\Config\ConfigFactoryInterface
*/
protected $configFactory;
/**
* Constructs a new LogAdminRouteSubscriber.
*
* @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('log.settings')
->get('log_use_admin_theme')) {
foreach ($collection
->all() as $route) {
if ($route
->hasOption('_log_operation_route')) {
$route
->setOption('_admin_route', TRUE);
}
}
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
LogAdminRouteSubscriber:: |
protected | property | The config factory. | |
LogAdminRouteSubscriber:: |
protected | function |
Alters existing routes for a specific collection. Overrides RouteSubscriberBase:: |
|
LogAdminRouteSubscriber:: |
public | function | Constructs a new LogAdminRouteSubscriber. | |
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 |