Chris@0: placeholderStrategy = $placeholder_strategy; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Processes placeholders for HTML responses. Chris@0: * Chris@0: * @param \Symfony\Component\HttpKernel\Event\FilterResponseEvent $event Chris@0: * The event to process. Chris@0: */ Chris@0: public function onRespond(FilterResponseEvent $event) { Chris@0: $response = $event->getResponse(); Chris@0: if (!$response instanceof HtmlResponse) { Chris@0: return; Chris@0: } Chris@0: Chris@0: $attachments = $response->getAttachments(); Chris@0: if (empty($attachments['placeholders'])) { Chris@0: return; Chris@0: } Chris@0: Chris@0: $attachments['placeholders'] = $this->placeholderStrategy->processPlaceholders($attachments['placeholders']); Chris@0: Chris@0: $response->setAttachments($attachments); Chris@0: } Chris@0: Chris@0: /** Chris@0: * {@inheritdoc} Chris@0: */ Chris@0: public static function getSubscribedEvents() { Chris@0: // Run shortly before HtmlResponseSubscriber. Chris@0: $events[KernelEvents::RESPONSE][] = ['onRespond', 5]; Chris@0: return $events; Chris@0: } Chris@0: Chris@0: }