You are here

public function ComponentsLoader::prependPath in Components! 8.2

1 call to ComponentsLoader::prependPath()
ComponentsLoader::setActiveTheme in src/Template/Loader/ComponentsLoader.php
Sets the namespaces based on the given active theme.

File

src/Template/Loader/ComponentsLoader.php, line 210

Class

ComponentsLoader
Loads templates from the filesystem.

Namespace

Drupal\components\Template\Loader

Code

public function prependPath($path, $namespace = self::MAIN_NAMESPACE) {

  // Invalidate the cache.
  $this->cache = $this->errorCache = [];
  $path = rtrim($path, '/\\');
  if (!isset($this->paths[$namespace])) {
    $this->paths[$namespace][] = $path;
  }
  else {
    array_unshift($this->paths[$namespace], $path);
  }
}