public function AbstractSurrogateFragmentRenderer::render in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/symfony/http-kernel/Fragment/AbstractSurrogateFragmentRenderer.php \Symfony\Component\HttpKernel\Fragment\AbstractSurrogateFragmentRenderer::render()
Note that if the current Request has no surrogate 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 the surrogate tag
Note, that not all surrogate strategies support all options. For now 'alt' and 'comment' are only supported by ESI.
Overrides FragmentRendererInterface::render
See also
Symfony\Component\HttpKernel\HttpCache\SurrogateInterface
File
- vendor/
symfony/ http-kernel/ Fragment/ AbstractSurrogateFragmentRenderer.php, line 64
Class
- AbstractSurrogateFragmentRenderer
- Implements Surrogate rendering strategy.
Namespace
Symfony\Component\HttpKernel\FragmentCode
public function render($uri, Request $request, array $options = array()) {
if (!$this->surrogate || !$this->surrogate
->hasSurrogateCapability($request)) {
return $this->inlineStrategy
->render($uri, $request, $options);
}
if ($uri instanceof ControllerReference) {
$uri = $this
->generateSignedFragmentUri($uri, $request);
}
$alt = isset($options['alt']) ? $options['alt'] : null;
if ($alt instanceof ControllerReference) {
$alt = $this
->generateSignedFragmentUri($alt, $request);
}
$tag = $this->surrogate
->renderIncludeTag($uri, $alt, isset($options['ignore_errors']) ? $options['ignore_errors'] : false, isset($options['comment']) ? $options['comment'] : '');
return new Response($tag);
}