function TwigNodeCheckDeprecations::compile

Same name and namespace in other branches
  1. 10 core/lib/Drupal/Core/Template/TwigNodeCheckDeprecations.php \Drupal\Core\Template\TwigNodeCheckDeprecations::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();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.