class NodeAdminRouteSubscriber in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/node/src/EventSubscriber/NodeAdminRouteSubscriber.php \Drupal\node\EventSubscriber\NodeAdminRouteSubscriber
Sets the _admin_route for specific node-related routes.
Hierarchy
- class \Drupal\Core\Routing\RouteSubscriberBase implements EventSubscriberInterface
- class \Drupal\node\EventSubscriber\NodeAdminRouteSubscriber
Expanded class hierarchy of NodeAdminRouteSubscriber
1 string reference to 'NodeAdminRouteSubscriber'
- node.services.yml in core/
modules/ node/ node.services.yml - core/modules/node/node.services.yml
1 service uses NodeAdminRouteSubscriber
File
- core/
modules/ node/ src/ EventSubscriber/ NodeAdminRouteSubscriber.php, line 17 - Contains \Drupal\node\EventSubscriber\NodeAdminRouteSubscriber.
Namespace
Drupal\node\EventSubscriberView source
class NodeAdminRouteSubscriber extends RouteSubscriberBase {
/**
* The config factory.
*
* @var \Drupal\Core\Config\ConfigFactoryInterface
*/
protected $configFactory;
/**
* Constructs a new NodeAdminRouteSubscriber.
*
* @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('node.settings')
->get('use_admin_theme')) {
foreach ($collection
->all() as $route) {
if ($route
->hasOption('_node_operation_route')) {
$route
->setOption('_admin_route', TRUE);
}
}
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
NodeAdminRouteSubscriber:: |
protected | property | The config factory. | |
NodeAdminRouteSubscriber:: |
protected | function |
Alters existing routes for a specific collection. Overrides RouteSubscriberBase:: |
|
NodeAdminRouteSubscriber:: |
public | function | Constructs a new NodeAdminRouteSubscriber. | |
RouteSubscriberBase:: |
public static | function |
Returns an array of event names this subscriber wants to listen to. Overrides EventSubscriberInterface:: |
5 |
RouteSubscriberBase:: |
public | function | Delegates the route altering to self::alterRoutes(). | 1 |