function twig_template_from_string in Translation template extractor 7.3
Same name and namespace in other branches
- 6.3 vendor/Twig/Extension/StringLoader.php \twig_template_from_string()
Loads a template from a string.
<pre> {{ include(template_from_string("Hello {{ name }}")) }} </pre>
Parameters
Twig_Environment $env A Twig_Environment instance:
string $template A template as a string or object implementing __toString():
Return value
Twig_Template A Twig_Template instance
1 string reference to 'twig_template_from_string'
- Twig_Extension_StringLoader::getFunctions in vendor/
Twig/ Extension/ StringLoader.php - Returns a list of functions to add to the existing list.
File
- vendor/
Twig/ Extension/ StringLoader.php, line 38
Code
function twig_template_from_string(Twig_Environment $env, $template) {
return $env
->createTemplate((string) $template);
}