You are here

public function Twig_Environment::addNodeVisitor in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/twig/twig/lib/Twig/Environment.php \Twig_Environment::addNodeVisitor()

Registers a Node Visitor.

Parameters

Twig_NodeVisitorInterface $visitor A Twig_NodeVisitorInterface instance:

File

vendor/twig/twig/lib/Twig/Environment.php, line 892

Class

Twig_Environment
Stores the Twig configuration.

Code

public function addNodeVisitor(Twig_NodeVisitorInterface $visitor) {
  if ($this->extensionInitialized) {
    throw new LogicException('Unable to add a node visitor as extensions have already been initialized.');
  }
  $this->staging
    ->addNodeVisitor($visitor);
}