Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 10 |
| NodeAdminRouteSubscriber | |
0.00% |
0 / 1 |
|
0.00% |
0 / 2 |
30 | |
0.00% |
0 / 10 |
| __construct | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 2 |
|||
| alterRoutes | |
0.00% |
0 / 1 |
20 | |
0.00% |
0 / 8 |
|||
| <?php | |
| /** | |
| * @file | |
| * Contains \Drupal\node\EventSubscriber\NodeAdminRouteSubscriber. | |
| */ | |
| namespace Drupal\node\EventSubscriber; | |
| use Drupal\Core\Config\ConfigFactoryInterface; | |
| use Drupal\Core\Routing\RouteSubscriberBase; | |
| use Symfony\Component\Routing\RouteCollection; | |
| /** | |
| * Sets the _admin_route for specific node-related routes. | |
| */ | |
| 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); | |
| } | |
| } | |
| } | |
| } | |
| } |