class ImceRouteSubscriber in IMCE 8.2
Same name and namespace in other branches
- 8 src/Routing/ImceRouteSubscriber.php \Drupal\imce\Routing\ImceRouteSubscriber
Listens to the dynamic route events.
Hierarchy
- class \Drupal\Core\Routing\RouteSubscriberBase implements \Symfony\Component\EventDispatcher\EventSubscriberInterface
- class \Drupal\imce\Routing\ImceRouteSubscriber
Expanded class hierarchy of ImceRouteSubscriber
1 string reference to 'ImceRouteSubscriber'
1 service uses ImceRouteSubscriber
File
- src/
Routing/ ImceRouteSubscriber.php, line 12
Namespace
Drupal\imce\RoutingView source
class ImceRouteSubscriber extends RouteSubscriberBase {
/**
* The constructor method.
*
* @var \Drupal\Core\Config\ConfigFactoryInterface
*/
protected $configFactory;
/**
* The constructor method.
*
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
* Defines the configuration object factory.
*/
public function __construct(ConfigFactoryInterface $config_factory) {
$this->configFactory = $config_factory;
}
/**
* {@inheritdoc}
*/
protected function alterRoutes(RouteCollection $collection) {
// Conditionally declare imce.page an admin route.
if ($route = $collection
->get('imce.page')) {
$config = $this->configFactory
->get('imce.settings');
if ($config
->get('admin_theme')) {
$route
->setOption('_admin_route', TRUE);
}
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ImceRouteSubscriber:: |
protected | property | The constructor method. | |
ImceRouteSubscriber:: |
protected | function |
Alters existing routes for a specific collection. Overrides RouteSubscriberBase:: |
|
ImceRouteSubscriber:: |
public | function | The constructor method. | |
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 |