function FilesystemLoader::addPath

Same name in other branches
  1. 8.9.x core/lib/Drupal/Core/Template/Loader/FilesystemLoader.php \Drupal\Core\Template\Loader\FilesystemLoader::addPath()
  2. 10 core/lib/Drupal/Core/Template/Loader/FilesystemLoader.php \Drupal\Core\Template\Loader\FilesystemLoader::addPath()
  3. 11.x core/lib/Drupal/Core/Template/Loader/FilesystemLoader.php \Drupal\Core\Template\Loader\FilesystemLoader::addPath()

Adds a path where templates are stored.

Parameters

string $path: A path where to look for templates.

string $namespace: (optional) A path name.

1 call to FilesystemLoader::addPath()
FilesystemLoader::__construct in core/lib/Drupal/Core/Template/Loader/FilesystemLoader.php
Constructs a new FilesystemLoader object.

File

core/lib/Drupal/Core/Template/Loader/FilesystemLoader.php, line 72

Class

FilesystemLoader
Loads templates from the filesystem.

Namespace

Drupal\Core\Template\Loader

Code

public function addPath($path, $namespace = self::MAIN_NAMESPACE) {
    // Invalidate the cache.
    $this->cache = [];
    $this->paths[$namespace][] = rtrim($path, '/\\');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.