public function Twig_Node_SandboxedPrint::compile

Compiles the node to PHP.

Parameters

Twig_Compiler A Twig_Compiler instance:

Overrides Twig_Node_Print::compile

File

drupal/core/vendor/twig/twig/lib/Twig/Node/SandboxedPrint.php, line 34

Class

Twig_Node_SandboxedPrint
Twig_Node_SandboxedPrint adds a check for the __toString() method when the variable is an object and the sandbox is activated.

Code

public function compile(Twig_Compiler $compiler) {
  $compiler
    ->addDebugInfo($this)
    ->write('echo $this->env->getExtension(\'sandbox\')->ensureToStringAllowed(')
    ->subcompile($this
    ->getNode('expr'))
    ->raw(");\n");
}