<?php
namespace Elements\Bundle\FrameworkBundle\EventListener;
use Pimcore\Event\DataObjectEvents;
use Pimcore\Event\Model\DataObjectEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpKernel\Event\RequestEvent;
use Symfony\Component\HttpKernel\Event\KernelEvent;
use Symfony\Component\HttpKernel\KernelEvents;
class InlineCssFullpageCacheHashListener implements EventSubscriberInterface
{
/**
* @inheritDoc
*/
public static function getSubscribedEvents()
{
return [
KernelEvents::REQUEST => ['onRequest', 111]
];
}
public function onRequest(RequestEvent $event)
{
if($event->isMasterRequest() && $event->getRequest()->cookies->has('inlinecss-loaded')) {
$_REQUEST['pimcore_cache_tag_suffix'] = $_REQUEST['pimcore_cache_tag_suffix'] ?? [];
$_REQUEST['pimcore_cache_tag_suffix'][] = 'inlinecss-loaded';
}
}
}