loader
class loader extends FilesystemLoader
Twig Template loader
Properties
protected | $safe_directories | ||
protected filesystem_interface | $filesystem |
Methods
Set safe directories
Add safe directory
Get current safe directories
Override for parent::validateName()
Adds a realpath call to fix a BC break in Twig 1.26 (https://github.com/twigphp/Twig/issues/2145)
Find the template
Details
at line 34
__construct(filesystem_interface $filesystem, string|array $paths = array())
Constructor
at line 47
FilesystemLoader
setSafeDirectories(array $directories = array())
Set safe directories
at line 68
FilesystemLoader
addSafeDirectory(string $directory)
Add safe directory
at line 85
array
getSafeDirectories()
Get current safe directories
at line 98
protected
validateName($name)
Override for parent::validateName()
This is done because we added support for safe directories, and when Twig findTemplate() is called, validateName() is called first, which would always throw an exception if the file is outside of the configured template directories.
at line 108
addPath($path, $namespace = self::MAIN_NAMESPACE)
Adds a realpath call to fix a BC break in Twig 1.26 (https://github.com/twigphp/Twig/issues/2145)
{@inheritdoc}
at line 119
protected
findTemplate($name, $throw = true)
Find the template
Override for \Twig\Loader\FilesystemLoader::findTemplate to add support for loading from safe directories.