fixed Twig_Node_Include
authorfabien <fabien@93ef8e89-cb99-4229-a87c-7fa0fa45744b>
Fri, 8 Jan 2010 15:26:17 +0000 (15:26 +0000)
committerfabien <fabien@93ef8e89-cb99-4229-a87c-7fa0fa45744b>
Fri, 8 Jan 2010 15:26:17 +0000 (15:26 +0000)
git-svn-id: http://svn.twig-project.org/trunk@221 93ef8e89-cb99-4229-a87c-7fa0fa45744b

lib/Twig/Node/Include.php

index d32e69b..0da7d2f 100644 (file)
@@ -17,7 +17,7 @@
  * @author     Fabien Potencier <fabien.potencier@symfony-project.com>
  * @version    SVN: $Id$
  */
-class Twig_Node_Include extends Twig_Node
+class Twig_Node_Include extends Twig_Node implements Twig_NodeListInterface
 {
   protected $expr;
   protected $sandboxed;
@@ -37,6 +37,32 @@ class Twig_Node_Include extends Twig_Node
     return get_class($this).'('.$this->expr.')';
   }
 
+  public function getNodes()
+  {
+    if (null === $this->variables)
+    {
+      return array(new Twig_Node_Text('', -1));
+    }
+    else
+    {
+      return array($this->variables);
+    }
+
+    return $this->variables->getNodes();
+  }
+
+  public function setNodes(array $nodes)
+  {
+    if (isset($nodes[0]) && -1 === $nodes[0]->getLine())
+    {
+      $this->variables = null;
+    }
+    else
+    {
+      $this->variables = $nodes[0];
+    }
+  }
+
   public function getIncludedFile()
   {
     return $this->expr;