public function EsiFragmentRenderer::render

Note that if the current Request has no ESI capability, this method falls back to use the inline rendering strategy.

Additional available options:

  • alt: an alternative URI to render in case of an error
  • comment: a comment to add when returning an esi:include tag

Overrides FragmentRendererInterface::render

See also

Symfony\Component\HttpKernel\HttpCache\ESI

File

drupal/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Fragment/EsiFragmentRenderer.php, line 57

Class

EsiFragmentRenderer
Implements the ESI rendering strategy.

Namespace

Symfony\Component\HttpKernel\Fragment

Code

public function render($uri, Request $request, array $options = array()) {
  if (!$this->esi
    ->hasSurrogateEsiCapability($request)) {
    return $this->inlineStrategy
      ->render($uri, $request, $options);
  }
  if ($uri instanceof ControllerReference) {
    $uri = $this
      ->generateFragmentUri($uri, $request);
  }
  $alt = isset($options['alt']) ? $options['alt'] : null;
  if ($alt instanceof ControllerReference) {
    $alt = $this
      ->generateFragmentUri($alt, $request);
  }
  $tag = $this->esi
    ->renderIncludeTag($uri, $alt, isset($options['ignore_errors']) ? $options['ignore_errors'] : false, isset($options['comment']) ? $options['comment'] : '');
  return new Response($tag);
}