You are here

protected function SupportTicketAdminRouteSubscriber::alterRoutes in Support Ticketing System 8

Alters existing routes for a specific collection.

Parameters

\Symfony\Component\Routing\RouteCollection $collection: The route collection for adding routes.

Overrides RouteSubscriberBase::alterRoutes

File

modules/support_ticket/src/EventSubscriber/SupportTicketAdminRouteSubscriber.php, line 39
Contains \Drupal\support_ticket\EventSubscriber\SupportTicketAdminRouteSubscriber.

Class

SupportTicketAdminRouteSubscriber
Sets the _admin_route for specific support ticket-related routes.

Namespace

Drupal\support_ticket\EventSubscriber

Code

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);
      }
    }
  }
}