function Environment::compileSource
Compiles a template source code.
Throws
SyntaxError When there was an error during tokenizing, parsing or compiling
3 calls to Environment::compileSource()
- Environment::loadTemplate in vendor/
twig/ twig/ src/ Environment.php - Loads a template internal representation.
- TwigEnvironment::compileSource in core/
lib/ Drupal/ Core/ Template/ TwigEnvironment.php - Compiles a template source code.
- TwigEnvironment::compileSource in core/
lib/ Drupal/ Core/ Template/ TwigEnvironment.php - Compiles a template source code.
1 method overrides Environment::compileSource()
- TwigEnvironment::compileSource in core/
lib/ Drupal/ Core/ Template/ TwigEnvironment.php - Compiles a template source code.
File
-
vendor/
twig/ twig/ src/ Environment.php, line 564
Class
- Environment
- Stores the Twig configuration and renders templates.
Namespace
TwigCode
public function compileSource(Source $source) : string {
try {
return $this->compile($this->parse($this->tokenize($source)));
} catch (Error $e) {
$e->setSourceContext($source);
throw $e;
} catch (\Exception $e) {
throw new SyntaxError(\sprintf('An exception has been thrown during the compilation of a template ("%s").', $e->getMessage()), -1, $source, $e);
}
}