protected function Twig_Loader_Filesystem::findTemplate

3 calls to Twig_Loader_Filesystem::findTemplate()
Twig_Loader_Filesystem::getCacheKey in drupal/core/vendor/twig/twig/lib/Twig/Loader/Filesystem.php
Gets the cache key to use for the cache for a given template name.
Twig_Loader_Filesystem::getSource in drupal/core/vendor/twig/twig/lib/Twig/Loader/Filesystem.php
Gets the source code of a template, given its name.
Twig_Loader_Filesystem::isFresh in drupal/core/vendor/twig/twig/lib/Twig/Loader/Filesystem.php
Returns true if the template is still fresh.

File

drupal/core/vendor/twig/twig/lib/Twig/Loader/Filesystem.php, line 112

Class

Twig_Loader_Filesystem
Loads template from the filesystem.

Code

protected function findTemplate($name) {

  // normalize name
  $name = preg_replace('#/{2,}#', '/', strtr($name, '\\', '/'));
  if (isset($this->cache[$name])) {
    return $this->cache[$name];
  }
  $this
    ->validateName($name);
  foreach ($this->paths as $path) {
    if (is_file($path . '/' . $name)) {
      return $this->cache[$name] = $path . '/' . $name;
    }
  }
  throw new Twig_Error_Loader(sprintf('Unable to find template "%s" (looked into: %s).', $name, implode(', ', $this->paths)));
}