
| Current Path : /var/www/html/rocksensor/web/core/lib/Drupal/Core/Template/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : /var/www/html/rocksensor/web/core/lib/Drupal/Core/Template/TwigNodeCheckDeprecations.php |
<?php
namespace Drupal\Core\Template;
use Twig\Compiler;
use Twig\Node\Expression\ArrayExpression;
use Twig\Node\Expression\ConstantExpression;
use Twig\Node\Node;
/**
* A node that checks deprecated variable usage.
*
* @see \Drupal\Core\Template\TwigNodeVisitorCheckDeprecations
* @see \Drupal\Core\Template\TwigExtension::checkDeprecations()
*/
class TwigNodeCheckDeprecations extends Node {
/**
* The named variables used in the template.
*/
protected array $usedNames = [];
/**
* {@inheritdoc}
*/
public function __construct(array $usedNames) {
$this->usedNames = $usedNames;
parent::__construct();
}
/**
* {@inheritdoc}
*/
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();
}
}