Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. HtmlResponsePlaceholderStrategySubscriber.php

function HtmlResponsePlaceholderStrategySubscriber::onRespond

Processes placeholders for HTML responses.

Parameters

\Symfony\Component\HttpKernel\Event\ResponseEvent $event: The event to process.

File

core/lib/Drupal/Core/EventSubscriber/HtmlResponsePlaceholderStrategySubscriber.php, line 45

Class

HtmlResponsePlaceholderStrategySubscriber
HTML response subscriber to allow for different placeholder strategies.

Namespace

Drupal\Core\EventSubscriber

Code

public function onRespond(ResponseEvent $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);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal