public function Twig_Loader_Filesystem::prependPath in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/twig/twig/lib/Twig/Loader/Filesystem.php \Twig_Loader_Filesystem::prependPath()
Prepends a path where templates are stored.
Parameters
string $path A path where to look for templates:
string $namespace A path name:
Throws
File
- vendor/
twig/ twig/ lib/ Twig/ Loader/ Filesystem.php, line 108
Class
- Twig_Loader_Filesystem
- Loads template from the filesystem.
Code
public function prependPath($path, $namespace = self::MAIN_NAMESPACE) {
// invalidate the cache
$this->cache = $this->errorCache = array();
if (!is_dir($path)) {
throw new Twig_Error_Loader(sprintf('The "%s" directory does not exist.', $path));
}
$path = rtrim($path, '/\\');
if (!isset($this->paths[$namespace])) {
$this->paths[$namespace][] = $path;
}
else {
array_unshift($this->paths[$namespace], $path);
}
}