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

Breadcrumb

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

function PsrResponseSubscriber::onKernelView

Converts a PSR-7 response to a Symfony response.

Parameters

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

File

core/lib/Drupal/Core/EventSubscriber/PsrResponseSubscriber.php, line 40

Class

PsrResponseSubscriber
Response subscriber for handling PSR-7 responses.

Namespace

Drupal\Core\EventSubscriber

Code

public function onKernelView(ViewEvent $event) {
    $controller_result = $event->getControllerResult();
    if ($controller_result instanceof ResponseInterface) {
        $event->setResponse($this->httpFoundationFactory
            ->createResponse($controller_result));
    }
}

API Navigation

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