vendor/elements/framework-bundle/src/EventListener/InlineCssFullpageCacheHashListener.php line 24

Open in your IDE?
  1. <?php
  2. namespace Elements\Bundle\FrameworkBundle\EventListener;
  3. use Pimcore\Event\DataObjectEvents;
  4. use Pimcore\Event\Model\DataObjectEvent;
  5. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  6. use Symfony\Component\HttpKernel\Event\RequestEvent;
  7. use Symfony\Component\HttpKernel\Event\KernelEvent;
  8. use Symfony\Component\HttpKernel\KernelEvents;
  9. class InlineCssFullpageCacheHashListener implements EventSubscriberInterface
  10. {
  11.     /**
  12.      * @inheritDoc
  13.      */
  14.     public static function getSubscribedEvents()
  15.     {
  16.         return [
  17.             KernelEvents::REQUEST => ['onRequest'111]
  18.         ];
  19.     }
  20.     public function onRequest(RequestEvent $event)
  21.     {
  22.         if($event->isMasterRequest() && $event->getRequest()->cookies->has('inlinecss-loaded')) {
  23.             $_REQUEST['pimcore_cache_tag_suffix'] = $_REQUEST['pimcore_cache_tag_suffix'] ?? [];
  24.             $_REQUEST['pimcore_cache_tag_suffix'][] = 'inlinecss-loaded';
  25.         }
  26.     }
  27. }