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

Breadcrumb

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

function TwigNodeCheckDeprecations::compile

Overrides Node::compile

File

core/lib/Drupal/Core/Template/TwigNodeCheckDeprecations.php, line 34

Class

TwigNodeCheckDeprecations
A node that checks deprecated variable usage.

Namespace

Drupal\Core\Template

Code

public function compile(Compiler $compiler) {
    $usedNamesNode = new ArrayExpression([], $this->getTemplateLine());
    foreach ($this->usedNames as $name) {
        $usedNamesNode->addElement(new ConstantExpression($name, $this->getTemplateLine()));
    }
    $compiler->write("\$this->env->getExtension('\\Drupal\\Core\\Template\\TwigExtension')\n");
    $compiler->indent();
    $compiler->write("->checkDeprecations(\$context, ");
    $compiler->subcompile($usedNamesNode);
    $compiler->raw(");");
    $compiler->outdent();
}
RSS feed
Powered by Drupal