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

Breadcrumb

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

function MacroReferenceExpression::compile

Overrides Node::compile

File

vendor/twig/twig/src/Node/Expression/MacroReferenceExpression.php, line 29

Class

MacroReferenceExpression
Represents a macro call node.

Namespace

Twig\Node\Expression

Code

public function compile(Compiler $compiler) : void {
    if ($this->getAttribute('is_defined_test')) {
        $compiler->subcompile($this->getNode('template'))
            ->raw('->hasMacro(')
            ->repr($this->getAttribute('name'))
            ->raw(', $context')
            ->raw(')');
        return;
    }
    $compiler->subcompile($this->getNode('template'))
        ->raw('->getTemplateForMacro(')
        ->repr($this->getAttribute('name'))
        ->raw(', $context, ')
        ->repr($this->getTemplateLine())
        ->raw(', $this->getSourceContext())')
        ->raw(\sprintf('->%s', $this->getAttribute('name')))
        ->raw('(...')
        ->subcompile($this->getNode('arguments'))
        ->raw(')');
}
RSS feed
Powered by Drupal