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

Breadcrumb

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

function CheckToStringNode::compile

Overrides Node::compile

1 method overrides CheckToStringNode::compile()
TwigSimpleCheckToStringNode::compile in core/lib/Drupal/Core/Template/TwigSimpleCheckToStringNode.php

File

vendor/twig/twig/src/Node/CheckToStringNode.php, line 36

Class

CheckToStringNode
Checks if casting an expression to __toString() is allowed by the sandbox.

Namespace

Twig\Node

Code

public function compile(Compiler $compiler) : void {
    $expr = $this->getNode('expr');
    $compiler->raw('$this->sandbox->ensureToStringAllowed(')
        ->subcompile($expr)
        ->raw(', ')
        ->repr($expr->getTemplateLine())
        ->raw(', $this->source)');
}
RSS feed
Powered by Drupal