protected function Twig_Node_Include::addGetTemplate

1 call to Twig_Node_Include::addGetTemplate()
Twig_Node_Include::compile in drupal/core/vendor/twig/twig/lib/Twig/Node/Include.php
Compiles the node to PHP.
1 method overrides Twig_Node_Include::addGetTemplate()
Twig_Node_Embed::addGetTemplate in drupal/core/vendor/twig/twig/lib/Twig/Node/Embed.php

File

drupal/core/vendor/twig/twig/lib/Twig/Node/Include.php, line 62

Class

Twig_Node_Include
Represents an include node.

Code

protected function addGetTemplate(Twig_Compiler $compiler) {
  if ($this
    ->getNode('expr') instanceof Twig_Node_Expression_Constant) {
    $compiler
      ->write("\$this->env->loadTemplate(")
      ->subcompile($this
      ->getNode('expr'))
      ->raw(")");
  }
  else {
    $compiler
      ->write("\$template = \$this->env->resolveTemplate(")
      ->subcompile($this
      ->getNode('expr'))
      ->raw(");\n")
      ->write('$template');
  }
}