diff --git a/core/lib/Drupal/Core/Template/Loader/FilesystemLoader.php b/core/lib/Drupal/Core/Template/Loader/FilesystemLoader.php index f909809..6317435 100644 --- a/core/lib/Drupal/Core/Template/Loader/FilesystemLoader.php +++ b/core/lib/Drupal/Core/Template/Loader/FilesystemLoader.php @@ -43,10 +43,19 @@ public function __construct($paths = array(), ModuleHandlerInterface $module_han foreach ($namespaces as $name => $path) { $templatesDirectory = $path . '/templates'; - if (file_exists($templatesDirectory)) { - $this->addPath($templatesDirectory, $name); - } + $this->addPath($templatesDirectory, $name); } } + /** + * Adds a path where templates are stored. + * + * @param string $path A path where to look for templates + * @param string $namespace A path name + */ + public function addPath($path, $namespace = self::MAIN_NAMESPACE) { + // Invalidate the cache. + $this->cache = array(); + $this->paths[$namespace][] = rtrim($path, '/\\'); + } }