You are here

function twig_template_from_string in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/twig/twig/lib/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/twig/lib/Twig/Extension/StringLoader.php

File

vendor/twig/twig/lib/Twig/Extension/StringLoader.php, line 38

Code

function twig_template_from_string(Twig_Environment $env, $template) {
  return $env
    ->createTemplate((string) $template);
}