Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. ImportNode.php

function ImportNode::compile

Overrides Node::compile

File

vendor/twig/twig/src/Node/ImportNode.php, line 43

Class

ImportNode
Represents an import node.

Namespace

Twig\Node

Code

public function compile(Compiler $compiler) : void {
    $compiler->subcompile($this->getNode('var'));
    if ($this->getNode('expr') instanceof NameExpression && '_self' === $this->getNode('expr')
        ->getAttribute('name')) {
        $compiler->raw('$this');
    }
    else {
        $compiler->raw('$this->loadTemplate(')
            ->subcompile($this->getNode('expr'))
            ->raw(', ')
            ->repr($this->getTemplateName())
            ->raw(', ')
            ->repr($this->getTemplateLine())
            ->raw(')->unwrap()');
    }
    $compiler->raw(";\n");
}
RSS feed
Powered by Drupal