Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. FilesystemLoader.php

function FilesystemLoader::prependPath

Throws

LoaderError

File

vendor/twig/twig/src/Loader/FilesystemLoader.php, line 108

Class

FilesystemLoader
Loads template from the filesystem.

Namespace

Twig\Loader

Code

public function prependPath(string $path, string $namespace = self::MAIN_NAMESPACE) : void {
    // invalidate the cache
    $this->cache = $this->errorCache = [];
    $checkPath = $this->isAbsolutePath($path) ? $path : $this->rootPath . $path;
    if (!is_dir($checkPath)) {
        throw new LoaderError(\sprintf('The "%s" directory does not exist ("%s").', $path, $checkPath));
    }
    $path = rtrim($path, '/\\');
    if (!isset($this->paths[$namespace])) {
        $this->paths[$namespace][] = $path;
    }
    else {
        array_unshift($this->paths[$namespace], $path);
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal