22 $nodes = array(
'expr' => $expr);
23 if (null !== $variables) {
24 $nodes[
'variables'] = $variables;
27 parent::__construct(
$nodes, array(
'only' => (
bool) $only,
'ignore_missing' => (
bool) $ignoreMissing),
$lineno,
$tag);
43 $compiler->
raw(
'->display(');
47 $compiler->
raw(
");\n");
52 ->write(
"} catch (Twig_Error_Loader \$e) {\n")
54 ->write(
"// ignore missing template\n")
64 ->
write(
'$this->loadTemplate(')
65 ->subcompile($this->
getNode(
'expr'))
76 if (!$this->
hasNode(
'variables')) {
77 $compiler->
raw(
false === $this->
getAttribute(
'only') ?
'$context' :
'array()');
80 ->
raw(
'array_merge($context, ')
81 ->subcompile($this->
getNode(
'variables'))
90 class_alias(
'Twig_Node_Include',
'Twig\Node\IncludeNode',
false);
raw($string)
Adds a raw string to the compiled code.
outdent($step=1)
Outdents the generated code.
subcompile(Twig_NodeInterface $node, $raw=true)
Represents a node in the AST.
Represents an include node.
Abstract class for all nodes that represents an expression.
addTemplateArguments(Twig_Compiler $compiler)
__construct(Twig_Node_Expression $expr, Twig_Node_Expression $variables=null, $only=false, $ignoreMissing=false, $lineno, $tag=null)
compile(Twig_Compiler $compiler)
Compiles the node to PHP.
addGetTemplate(Twig_Compiler $compiler)
Represents a displayable node in the AST.
addDebugInfo(Twig_NodeInterface $node)
Adds debugging information.
write()
Writes a string to the compiled code by adding indentation.