Called before child nodes are visited.
Twig_NodeInterface $node The node to visit:
Twig_Environment $env The Twig environment instance:
Twig_NodeInterface The modified node
Overrides Twig_NodeVisitorInterface::enterNode
public function enterNode(Twig_NodeInterface $node, Twig_Environment $env) {
if ($node instanceof Twig_Node_Module) {
if ($env
->hasExtension('escaper') && ($defaultStrategy = $env
->getExtension('escaper')
->getDefaultStrategy($node
->getAttribute('filename')))) {
$this->defaultStrategy = $defaultStrategy;
}
}
elseif ($node instanceof Twig_Node_AutoEscape) {
$this->statusStack[] = $node
->getAttribute('value');
}
elseif ($node instanceof Twig_Node_Block) {
$this->statusStack[] = isset($this->blocks[$node
->getAttribute('name')]) ? $this->blocks[$node
->getAttribute('name')] : $this
->needEscaping($env);
}
return $node;
}