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

Breadcrumb

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

function AssignTemplateVariable::compile

Overrides Node::compile

File

vendor/twig/twig/src/Node/Expression/Variable/AssignTemplateVariable.php, line 24

Class

AssignTemplateVariable

Namespace

Twig\Node\Expression\Variable

Code

public function compile(Compiler $compiler) : void {
    
    /** @var TemplateVariable $var */
    $var = $this->nodes['var'];
    $compiler->addDebugInfo($this)
        ->write('$macros[')
        ->string($var->getName($compiler))
        ->raw('] = ');
    if ($this->getAttribute('global')) {
        $compiler->raw('$this->macros[')
            ->string($var->getName($compiler))
            ->raw('] = ');
    }
}
RSS feed
Powered by Drupal