vendor/oveleon/contao-component-style-manager/src/EventSubscriber/KernelRequestSubscriber.php line 24

Open in your IDE?
  1. <?php
  2. namespace Oveleon\ContaoComponentStyleManager\EventSubscriber;
  3. use Contao\CoreBundle\Routing\ScopeMatcher;
  4. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  5. use Symfony\Component\HttpKernel\Event\RequestEvent;
  6. use Symfony\Component\HttpKernel\KernelEvents;
  7. class KernelRequestSubscriber implements EventSubscriberInterface
  8. {
  9.     protected $scopeMatcher;
  10.     public function __construct(ScopeMatcher $scopeMatcher)
  11.     {
  12.         $this->scopeMatcher $scopeMatcher;
  13.     }
  14.     public static function getSubscribedEvents()
  15.     {
  16.         return [KernelEvents::REQUEST => 'onKernelRequest'];
  17.     }
  18.     public function onKernelRequest(RequestEvent $e): void
  19.     {
  20.         $request $e->getRequest();
  21.         if ($this->scopeMatcher->isBackendRequest($request)) {
  22.             $GLOBALS['TL_CSS'][] = 'bundles/contaocomponentstylemanager/stylemanager.css|static';
  23.         }
  24.     }
  25. }