public function loadTemplate($name, $index = null)
 {
     // If legacy engine supports given template, delegate it.
     if (is_string($name) && isset($this->legacyTemplatesCache[$name])) {
         return $this->legacyTemplatesCache[$name];
     }
     if (is_string($name) && $this->legacyEngine->supports($name)) {
         $this->legacyTemplatesCache[$name] = new Template($name, $this, $this->legacyEngine);
         return $this->legacyTemplatesCache[$name];
     }
     return parent::loadTemplate($name, $index);
 }
 public function loadTemplate($name, $index = null)
 {
     // If legacy engine supports given template, delegate it.
     if (is_string($name) && isset($this->legacyTemplatesCache[$name])) {
         return $this->legacyTemplatesCache[$name];
     }
     if (is_string($name) && $this->legacyEngine->supports($name)) {
         if (!$this->legacyEngine->exists($name)) {
             throw new Twig_Error_Loader("Unable to find the template \"{$name}\"");
         }
         $this->legacyTemplatesCache[$name] = new Template($name, $this, $this->legacyEngine);
         return $this->legacyTemplatesCache[$name];
     }
     return parent::loadTemplate($name, $index);
 }
 /**
  * @param $tplName
  * @param $expected
  *
  * @covers \eZ\Publish\Core\MVC\Legacy\Templating\LegacyEngine::supports
  *
  * @dataProvider supportTestProvider
  */
 public function testSupports($tplName, $expected)
 {
     $this->assertSame($expected, $this->engine->supports($tplName));
 }
 /**
  * Renders a legacy template.
  *
  * @param string $tplPath Path to template (i.e. "design:setup/info.tpl")
  * @param array $params Parameters to pass to template.
  *                      Consists of a hash with key as the variable name available in the template.
  *
  * @return string The legacy template result
  *
  * @deprecated since 5.1
  */
 public function renderTemplate($tplPath, array $params = array())
 {
     return $this->legacyEngine->render($tplPath, $params);
 }
 /**
  * Renders the template with the given context and returns it as string.
  *
  * @param array $context An array of parameters to pass to the template
  *
  * @return string The rendered template
  */
 public function render(array $context)
 {
     return $this->legacyEngine->render($this->templateName, $context);
 }