SupportTicketAdminRouteSubscriber.php in Support Ticketing System 8
File
modules/support_ticket/src/EventSubscriber/SupportTicketAdminRouteSubscriber.php
View source
<?php
namespace Drupal\support_ticket\EventSubscriber;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Routing\RouteSubscriberBase;
use Symfony\Component\Routing\RouteCollection;
class SupportTicketAdminRouteSubscriber extends RouteSubscriberBase {
protected $configFactory;
public function __construct(ConfigFactoryInterface $config_factory) {
$this->configFactory = $config_factory;
}
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);
}
}
}
}
}