twig_template_from_string

Loads a template from a string.

Description

(Twig_Template) twig_template_from_string( (Twig_Environment) Twig_Environment $env, (string) $template ); 

Returns (Twig_Template)

Parameters (2)

0. $env (Twig_Environment) => Twig_Environment $env
A Twig_Environment instance
1. $template (string)
A template as a string or object implementing __toString()

Usage

  1. if ( !function_exists( 'twig_template_from_string' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'woocommerce-multilingual/vendor/twig/twig/lib/Twig/Extension/StringLoader.php'; 
  3.  
  4. // A Twig_Environment instance 
  5. $env = Twig_Environment $env; 
  6.  
  7. // A template as a string or object implementing __toString() 
  8. $template = ''; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = twig_template_from_string($env, $template); 
  12.  

Defined (1)

The function is defined in the following location(s).

/vendor/twig/twig/lib/Twig/Extension/StringLoader.php  
  1. function twig_template_from_string(Twig_Environment $env, $template) 
  2. return $env->createTemplate((string) $template);