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

Breadcrumb

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

function FunctionExpression::compile

Overrides Node::compile

4 calls to FunctionExpression::compile()
EnumCasesFunction::compile in vendor/twig/twig/src/Node/Expression/FunctionNode/EnumCasesFunction.php
EnumCasesFunction::compile in vendor/twig/twig/src/Node/Expression/FunctionNode/EnumCasesFunction.php
EnumFunction::compile in vendor/twig/twig/src/Node/Expression/FunctionNode/EnumFunction.php
EnumFunction::compile in vendor/twig/twig/src/Node/Expression/FunctionNode/EnumFunction.php
2 methods override FunctionExpression::compile()
EnumCasesFunction::compile in vendor/twig/twig/src/Node/Expression/FunctionNode/EnumCasesFunction.php
EnumFunction::compile in vendor/twig/twig/src/Node/Expression/FunctionNode/EnumFunction.php

File

vendor/twig/twig/src/Node/Expression/FunctionExpression.php, line 47

Class

FunctionExpression

Namespace

Twig\Node\Expression

Code

public function compile(Compiler $compiler) {
    $name = $this->getAttribute('name');
    if ($this->hasAttribute('twig_callable')) {
        $name = $this->getAttribute('twig_callable')
            ->getName();
        if ($name !== $this->getAttribute('name')) {
            trigger_deprecation('twig/twig', '3.12', 'Changing the value of a "function" node in a NodeVisitor class is not supported anymore.');
            $this->removeAttribute('twig_callable');
        }
    }
    if (!$this->hasAttribute('twig_callable')) {
        $this->setAttribute('twig_callable', $compiler->getEnvironment()
            ->getFunction($name));
    }
    if ('constant' === $name && $this->getAttribute('is_defined_test')) {
        $this->getNode('arguments')
            ->setNode('checkDefined', new ConstantExpression(true, $this->getTemplateLine()));
    }
    $this->compileCallable($compiler);
}
RSS feed
Powered by Drupal