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