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

Breadcrumb

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

function SandboxNodeVisitor::wrapNode

2 calls to SandboxNodeVisitor::wrapNode()
SandboxNodeVisitor::enterNode in vendor/twig/twig/src/NodeVisitor/SandboxNodeVisitor.php
Called before child nodes are visited.
SandboxNodeVisitor::wrapArrayNode in vendor/twig/twig/src/NodeVisitor/SandboxNodeVisitor.php

File

vendor/twig/twig/src/NodeVisitor/SandboxNodeVisitor.php, line 122

Class

SandboxNodeVisitor
@author Fabien Potencier <fabien@symfony.com>

Namespace

Twig\NodeVisitor

Code

private function wrapNode(Node $node, string $name) : void {
    $expr = $node->getNode($name);
    if (($expr instanceof NameExpression || $expr instanceof GetAttrExpression) && !$expr->isGenerator()) {
        // Simplify in 4.0 as the spread attribute has been removed there
        $new = new CheckToStringNode($expr);
        if ($expr->hasAttribute('spread')) {
            $new->setAttribute('spread', $expr->getAttribute('spread'));
        }
        $node->setNode($name, $new);
    }
    elseif ($expr instanceof SpreadUnary) {
        $this->wrapNode($expr, 'node');
    }
    elseif ($expr instanceof ArrayExpression) {
        foreach ($expr as $name => $_) {
            $this->wrapNode($expr, $name);
        }
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal