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

Breadcrumb

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

function InlineFragmentRenderer::createSubRequest

1 call to InlineFragmentRenderer::createSubRequest()
InlineFragmentRenderer::render in vendor/symfony/http-kernel/Fragment/InlineFragmentRenderer.php
Additional available options:

File

vendor/symfony/http-kernel/Fragment/InlineFragmentRenderer.php, line 103

Class

InlineFragmentRenderer
Implements the inline rendering strategy where the Request is rendered by the current HTTP kernel.

Namespace

Symfony\Component\HttpKernel\Fragment

Code

protected function createSubRequest(string $uri, Request $request) : Request {
    $cookies = $request->cookies
        ->all();
    $server = $request->server
        ->all();
    unset($server['HTTP_IF_MODIFIED_SINCE']);
    unset($server['HTTP_IF_NONE_MATCH']);
    $subRequest = Request::create($uri, 'get', [], $cookies, [], $server);
    if ($request->headers
        ->has('Surrogate-Capability')) {
        $subRequest->headers
            ->set('Surrogate-Capability', $request->headers
            ->get('Surrogate-Capability'));
    }
    static $setSession;
    $setSession ??= \Closure::bind(static function ($subRequest, $request) {
        $subRequest->session = $request->session;
    }, null, Request::class);
    $setSession($subRequest, $request);
    if ($request->get('_format')) {
        $subRequest->attributes
            ->set('_format', $request->get('_format'));
    }
    if ($request->getDefaultLocale() !== $request->getLocale()) {
        $subRequest->setLocale($request->getLocale());
    }
    if ($request->attributes
        ->has('_stateless')) {
        $subRequest->attributes
            ->set('_stateless', $request->attributes
            ->get('_stateless'));
    }
    if ($request->attributes
        ->has('_check_controller_is_allowed')) {
        $subRequest->attributes
            ->set('_check_controller_is_allowed', $request->attributes
            ->get('_check_controller_is_allowed'));
    }
    return $subRequest;
}

API Navigation

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