function TestNodeVisitor::leaveNode

Same name in this branch
  1. 11.x core/modules/sdc/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/system/tests/modules/sdc_other_node_visitor/src/Twig/NodeVisitor/TestNodeVisitor.php, line 54

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 Nodes([
      new EnterProfileNode($this->extensionName, $this->varName),
      $node->getNode('display_start'),
    ]));
    $node->setNode('display_end', new Nodes([
      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.