diff --git a/composer.json b/composer.json index ef6204a..d898f87 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "aygon/twig-stack", + "name": "bfgasparin/twig-stack", "type": "library", "description": "Twig extension which adds the possibility to push content to a stack which can be output anywhere in the template", "keywords": ["templating"], diff --git a/lib/TwigStack/NodeVisitor/StackNodeVisitor.php b/lib/TwigStack/NodeVisitor/StackNodeVisitor.php index 7781779..2d3ae4c 100644 --- a/lib/TwigStack/NodeVisitor/StackNodeVisitor.php +++ b/lib/TwigStack/NodeVisitor/StackNodeVisitor.php @@ -54,7 +54,7 @@ public function leaveNode(\Twig_NodeInterface $node, \Twig_Environment $env) */ private function handleModuleNode(\Twig_Node_Module $node) { - if ($node->hasNode('body') && null === $node->getNode('parent')) { + if ($node->hasNode('body') && (!$node->hasNode('parent') || null === $node->getNode('parent'))) { $body = $node->getNode('body'); $node->setNode('body', new StackBodyNode($body)); } @@ -70,4 +70,4 @@ public function getPriority() { return -10; } -} \ No newline at end of file +}