Browse Source

Fixes Twig to ignore non-path aliases instead of erroring

tags/2.0.0-rc
Alexander Makarov 10 years ago
parent
commit
b44a900779
  1. 2
      extensions/twig/ViewRenderer.php

2
extensions/twig/ViewRenderer.php

@ -146,8 +146,10 @@ class ViewRenderer extends BaseViewRenderer
$loader = new \Twig_Loader_Filesystem(dirname($file)); $loader = new \Twig_Loader_Filesystem(dirname($file));
foreach (Yii::$aliases as $alias => $path) { foreach (Yii::$aliases as $alias => $path) {
if (is_dir($path)) {
$loader->addPath($path, substr($alias, 1)); $loader->addPath($path, substr($alias, 1));
} }
}
$this->twig->setLoader($loader); $this->twig->setLoader($loader);
return $this->twig->render(pathinfo($file, PATHINFO_BASENAME), $params); return $this->twig->render(pathinfo($file, PATHINFO_BASENAME), $params);

Loading…
Cancel
Save