class LazyLoadingFragmentHandler extends FragmentHandler

Lazily loads fragment renderers from the dependency injection container.

Methods

__construct(ContainerInterface $container, RequestStack $requestStack, bool $debug = false)

Constructor.

addRenderer(FragmentRendererInterface $renderer)

Adds a renderer.

string|null
render(string|ControllerReference $uri, string $renderer = 'inline', array $options = array())

Renders a URI and returns the Response content.

addRendererService($name, $renderer)

Adds a service as a fragment renderer.

Details

at line line 35
__construct(ContainerInterface $container, RequestStack $requestStack, bool $debug = false)

Constructor.

Parameters

ContainerInterface $container A container
RequestStack $requestStack The Request stack that controls the lifecycle of requests
bool $debug Whether the debug mode is enabled or not

in FragmentHandler at line line 57
addRenderer(FragmentRendererInterface $renderer)

Adds a renderer.

Parameters

FragmentRendererInterface $renderer A FragmentRendererInterface instance

at line line 55
string|null render(string|ControllerReference $uri, string $renderer = 'inline', array $options = array())

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

Exceptions

InvalidArgumentException when the renderer does not exist
LogicException when no master request is being handled

at line line 47
addRendererService($name, $renderer)

Adds a service as a fragment renderer.

Parameters

$name
$renderer