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