protected function DialogController::forward

Forwards request to a subrequest.

Parameters

\Symfony\Component\HttpFoundation\RequestRequest $request: The request object.

callable $content: The body content callable that contains the body region of this page.

Return value

\Symfony\Component\HttpFoundation\Response A response object.

1 call to DialogController::forward()
DialogController::dialog in drupal/core/lib/Drupal/Core/Controller/DialogController.php
Displays content in a dialog.

File

drupal/core/lib/Drupal/Core/Controller/DialogController.php, line 47
Contains \Drupal\Core\Controller\DialogController.

Class

DialogController
Defines a default controller for dialog requests.

Namespace

Drupal\Core\Controller

Code

protected function forward(Request $request, $content) {

  // @todo When we have a Generator, we can replace the forward() call with
  // a render() call, which would handle ESI and hInclude as well.  That will
  // require an _internal route.  For examples, see:
  // https://github.com/symfony/symfony/blob/master/src/Symfony/Bundle/FrameworkBundle/Resources/config/routing/internal.xml
  // https://github.com/symfony/symfony/blob/master/src/Symfony/Bundle/FrameworkBundle/Controller/InternalController.php
  $attributes = clone $request->attributes;

  // We need to clean up the derived information and such so that the
  // subrequest can be processed properly without leaking data through.
  $attributes
    ->remove('system_path');

  // Remove the accept header so the subrequest does not end up back in this
  // controller.
  $request->headers
    ->remove('accept');
  return $this->httpKernel
    ->forward($content, $attributes
    ->all(), $request->query
    ->all());
}