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

Breadcrumb

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

function ChainLoader::getSourceContext

Overrides LoaderInterface::getSourceContext

File

vendor/twig/twig/src/Loader/ChainLoader.php, line 61

Class

ChainLoader
Loads templates from other loaders.

Namespace

Twig\Loader

Code

public function getSourceContext(string $name) : Source {
    $exceptions = [];
    foreach ($this->getLoaders() as $loader) {
        if (!$loader->exists($name)) {
            continue;
        }
        try {
            return $loader->getSourceContext($name);
        } catch (LoaderError $e) {
            $exceptions[] = $e->getMessage();
        }
    }
    throw new LoaderError(\sprintf('Template "%s" is not defined%s.', $name, $exceptions ? ' (' . implode(', ', $exceptions) . ')' : ''));
}
RSS feed
Powered by Drupal