You are here

public function FragmentHandler::render in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/symfony/http-kernel/Fragment/FragmentHandler.php \Symfony\Component\HttpKernel\Fragment\FragmentHandler::render()

Renders a URI and returns the Response content.

Available options:

  • ignore_errors: true to return an empty string in case of an error

Parameters

string|ControllerReference $uri A URI as a string or a ControllerReference instance:

string $renderer The renderer name:

array $options An array of options:

Return value

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

Throws

\InvalidArgumentException when the renderer does not exist

\LogicException when no master request is being handled

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

File

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

Class

FragmentHandler
Renders a URI that represents a resource fragment.

Namespace

Symfony\Component\HttpKernel\Fragment

Code

public function render($uri, $renderer = 'inline', array $options = array()) {
  if (!isset($options['ignore_errors'])) {
    $options['ignore_errors'] = !$this->debug;
  }
  if (!isset($this->renderers[$renderer])) {
    throw new \InvalidArgumentException(sprintf('The "%s" renderer does not exist.', $renderer));
  }
  if (!($request = $this
    ->getRequest())) {
    throw new \LogicException('Rendering a fragment can only be done when handling a Request.');
  }
  return $this
    ->deliver($this->renderers[$renderer]
    ->render($uri, $request, $options));
}