public function render($name, array $parameters = array()) { list(, $options) = $this->splitTemplateName($name); $renderer = $options['renderer']; if (isset($this->renderers[$renderer]) && is_string($this->renderers[$renderer])) { $this->renderers[$renderer] = $this->container->get($this->renderers[$renderer]); $this->renderers[$renderer]->setEngine($this); } if ('php' === $renderer) { $parameters = $this->escapeParameters($parameters); } return parent::render($name, $parameters); }
public function render($name, array $parameters = array()) { ++$this->level; list(, $options) = $this->splitTemplateName($name); if ('php' === $options['renderer']) { // escape only once if (1 === $this->level && !isset($parameters['_data'])) { $parameters = $this->escapeParameters($parameters); } } $content = parent::render($name, $parameters); --$this->level; return $content; }
/** * Constructor. * * @param ContainerInterface $container A ContainerInterface instance * @param LoaderInterface $loader A loader instance */ public function __construct(ContainerInterface $container, LoaderInterface $loader) { $this->container = $container; parent::__construct($loader); foreach ($this->container->findTaggedServiceIds('templating.renderer') as $id => $attributes) { if (isset($attributes[0]['alias'])) { $this->renderers[$attributes[0]['alias']] = $this->container->get($id); $this->renderers[$attributes[0]['alias']]->setEngine($this); } } $this->helpers = array(); foreach ($this->container->findTaggedServiceIds('templating.helper') as $id => $attributes) { if (isset($attributes[0]['alias'])) { $this->helpers[$attributes[0]['alias']] = $id; } } }
public function render($name, array $parameters = array()) { ++$this->level; list(, $options) = $this->splitTemplateName($name); $renderer = $options['renderer']; if (isset($this->renderers[$renderer]) && is_string($this->renderers[$renderer])) { $this->renderers[$renderer] = $this->container->get($this->renderers[$renderer]); $this->renderers[$renderer]->setEngine($this); } if ('php' === $renderer) { // escape only once if (1 === $this->level && !isset($parameters['_data'])) { $parameters = $this->escapeParameters($parameters); } } $content = parent::render($name, $parameters); --$this->level; return $content; }
/** * Constructor. * * @param ContainerInterface $container The DI container * @param LoaderInterface $loader A loader instance * @param array $renderers All templating renderers */ public function __construct(ContainerInterface $container, LoaderInterface $loader, array $renderers) { $this->container = $container; parent::__construct($loader, $renderers); }