class LazyLoadingFragmentHandler in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/http-kernel/DependencyInjection/LazyLoadingFragmentHandler.php \Symfony\Component\HttpKernel\DependencyInjection\LazyLoadingFragmentHandler
Lazily loads fragment renderers from the dependency injection container.
@author Fabien Potencier <fabien@symfony.com>
Hierarchy
- class \Symfony\Component\HttpKernel\Fragment\FragmentHandler
- class \Symfony\Component\HttpKernel\DependencyInjection\LazyLoadingFragmentHandler
Expanded class hierarchy of LazyLoadingFragmentHandler
1 file declares its use of LazyLoadingFragmentHandler
- LazyLoadingFragmentHandlerTest.php in vendor/
symfony/ http-kernel/ Tests/ DependencyInjection/ LazyLoadingFragmentHandlerTest.php
File
- vendor/
symfony/ http-kernel/ DependencyInjection/ LazyLoadingFragmentHandler.php, line 23
Namespace
Symfony\Component\HttpKernel\DependencyInjectionView source
class LazyLoadingFragmentHandler extends FragmentHandler {
private $container;
private $rendererIds = array();
public function __construct(ContainerInterface $container, $debug = false, RequestStack $requestStack = null) {
$this->container = $container;
parent::__construct(array(), $debug, $requestStack);
}
/**
* Adds a service as a fragment renderer.
*
* @param string $renderer The render service id
*/
public function addRendererService($name, $renderer) {
$this->rendererIds[$name] = $renderer;
}
/**
* {@inheritdoc}
*/
public function render($uri, $renderer = 'inline', array $options = array()) {
if (isset($this->rendererIds[$renderer])) {
$this
->addRenderer($this->container
->get($this->rendererIds[$renderer]));
unset($this->rendererIds[$renderer]);
}
return parent::render($uri, $renderer, $options);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
FragmentHandler:: |
private | property | ||
FragmentHandler:: |
private | property | ||
FragmentHandler:: |
private | property | ||
FragmentHandler:: |
private | property | ||
FragmentHandler:: |
public | function | Adds a renderer. | |
FragmentHandler:: |
protected | function | Delivers the Response as a string. | |
FragmentHandler:: |
private | function | ||
FragmentHandler:: |
public | function | Sets the current Request. | |
LazyLoadingFragmentHandler:: |
private | property | ||
LazyLoadingFragmentHandler:: |
private | property | ||
LazyLoadingFragmentHandler:: |
public | function | Adds a service as a fragment renderer. | |
LazyLoadingFragmentHandler:: |
public | function |
Renders a URI and returns the Response content. Overrides FragmentHandler:: |
|
LazyLoadingFragmentHandler:: |
public | function |
Constructor. Overrides FragmentHandler:: |