function TestLoader::getSourceContext

Same name in other branches
  1. 8.9.x core/modules/system/tests/modules/twig_loader_test/src/Loader/TestLoader.php \Drupal\twig_loader_test\Loader\TestLoader::getSourceContext()
  2. 10 core/modules/system/tests/modules/twig_loader_test/src/Loader/TestLoader.php \Drupal\twig_loader_test\Loader\TestLoader::getSourceContext()
  3. 11.x core/modules/system/tests/modules/twig_loader_test/src/Loader/TestLoader.php \Drupal\twig_loader_test\Loader\TestLoader::getSourceContext()

File

core/modules/system/tests/modules/twig_loader_test/src/Loader/TestLoader.php, line 16

Class

TestLoader
A test Twig loader.

Namespace

Drupal\twig_loader_test\Loader

Code

public function getSourceContext($name) {
    $name = (string) $name;
    $value = $name === 'kittens' ? 'kittens' : 'cats';
    return new Source($value, $name);
}

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