/** * {@inheritdoc} */ protected function doLeaveNode(Twig_Node $node, Twig_Environment $env) { if ($this->shouldProcess()) { if ($node instanceof Twig_Node_Module) { if ($this->shouldBufferizeBody) { $node->setNode('body', new Twig_Node(array(new Init(), $node->getNode('body'), new Output()))); } $this->shouldBufferizeBody = false; } } $node = parent::doLeaveNode($node, $env); return $node; }
/** * {@inheritdoc} */ protected function doLeaveNode(Twig_Node $node, Twig_Environment $env) { if ($this->shouldProcess()) { if ($node instanceof Twig_Node_Module) { $this->blocks = null; } if (!$this->currentScope && $this->isAssetsInjectionNode($node)) { return new Twig_Node([new Start(), $node, new End()]); } elseif (!$this->currentScope && $node instanceof Twig_Node_BlockReference && $this->hasAssetsInjection($this->blocks[$node->getAttribute('name')])) { return new Twig_Node([new Start(), $node, new End()]); } } parent::doLeaveNode($node, $env); return $node; }