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