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

Breadcrumb

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

function FragmentHandler::deliver

Delivers the Response as a string.

When the Response is a StreamedResponse, the content is streamed immediately instead of being returned.

Return value

string|null The Response content or null when the Response is streamed

Throws

\RuntimeException when the Response is not successful

1 call to FragmentHandler::deliver()
FragmentHandler::render in vendor/symfony/http-kernel/Fragment/FragmentHandler.php
Renders a URI and returns the Response content.

File

vendor/symfony/http-kernel/Fragment/FragmentHandler.php, line 94

Class

FragmentHandler
Renders a URI that represents a resource fragment.

Namespace

Symfony\Component\HttpKernel\Fragment

Code

protected function deliver(Response $response) : ?string {
    if (!$response->isSuccessful()) {
        $responseStatusCode = $response->getStatusCode();
        throw new \RuntimeException(\sprintf('Error when rendering "%s" (Status code is %d).', $this->requestStack
            ->getCurrentRequest()
            ->getUri(), $responseStatusCode), 0, new HttpException($responseStatusCode));
    }
    if (!$response instanceof StreamedResponse) {
        return $response->getContent();
    }
    $response->sendContent();
    return null;
}

API Navigation

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