You are here

protected function Twig_Node_Module::compileLoadTemplate in Translation template extractor 7.3

Same name and namespace in other branches
  1. 6.3 vendor/Twig/Node/Module.php \Twig_Node_Module::compileLoadTemplate()
1 call to Twig_Node_Module::compileLoadTemplate()
Twig_Node_Module::compileConstructor in vendor/Twig/Node/Module.php

File

vendor/Twig/Node/Module.php, line 387

Class

Twig_Node_Module
Represents a module node.

Code

protected function compileLoadTemplate(Twig_Compiler $compiler, $node, $var) {
  if ($node instanceof Twig_Node_Expression_Constant) {
    $compiler
      ->write(sprintf('%s = $this->loadTemplate(', $var))
      ->subcompile($node)
      ->raw(', ')
      ->repr($compiler
      ->getFilename())
      ->raw(', ')
      ->repr($node
      ->getLine())
      ->raw(");\n");
  }
  else {
    throw new LogicException('Trait templates can only be constant nodes');
  }
}