function TestNodeVisitor::leaveNode

Same name in this branch
  1. 11.x core/modules/system/tests/modules/sdc_other_node_visitor/src/Twig/NodeVisitor/TestNodeVisitor.php \Drupal\sdc_other_node_visitor\Twig\NodeVisitor\TestNodeVisitor::leaveNode()
Same name and namespace in other branches
  1. 10 core/modules/sdc/tests/modules/sdc_other_node_visitor/src/Twig/NodeVisitor/TestNodeVisitor.php \Drupal\sdc_other_node_visitor\Twig\NodeVisitor\TestNodeVisitor::leaveNode()
  2. 10 core/modules/system/tests/modules/sdc_other_node_visitor/src/Twig/NodeVisitor/TestNodeVisitor.php \Drupal\sdc_other_node_visitor\Twig\NodeVisitor\TestNodeVisitor::leaveNode()

File

core/modules/sdc/tests/modules/sdc_other_node_visitor/src/Twig/NodeVisitor/TestNodeVisitor.php, line 45

Class

TestNodeVisitor
A node visitor that adds nodes to the Twig template.

Namespace

Drupal\sdc_other_node_visitor\Twig\NodeVisitor

Code

public function leaveNode(Node $node, Environment $env) : ?Node {
    if ($node instanceof ModuleNode) {
        $node->setNode('display_start', new Node([
            new EnterProfileNode($this->extensionName, $this->varName),
            $node->getNode('display_start'),
        ]));
        $node->setNode('display_end', new Node([
            new LeaveProfileNode($this->varName),
            $node->getNode('display_end'),
        ]));
    }
    return $node;
}

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