Browse code

fixed Twig_Node_Include

git-svn-id: http://svn.twig-project.org/trunk@221 93ef8e89-cb99-4229-a87c-7fa0fa45744b

fabien authored on 08/01/2010 15:26:17
Showing 1 changed files
... ...
@@ -17,7 +17,7 @@
17 17
  * @author     Fabien Potencier <fabien.potencier@symfony-project.com>
18 18
  * @version    SVN: $Id$
19 19
  */
20
-class Twig_Node_Include extends Twig_Node
20
+class Twig_Node_Include extends Twig_Node implements Twig_NodeListInterface
21 21
 {
22 22
   protected $expr;
23 23
   protected $sandboxed;
... ...
@@ -37,6 +37,32 @@ class Twig_Node_Include extends Twig_Node
37 37
     return get_class($this).'('.$this->expr.')';
38 38
   }
39 39
 
40
+  public function getNodes()
41
+  {
42
+    if (null === $this->variables)
43
+    {
44
+      return array(new Twig_Node_Text('', -1));
45
+    }
46
+    else
47
+    {
48
+      return array($this->variables);
49
+    }
50
+
51
+    return $this->variables->getNodes();
52
+  }
53
+
54
+  public function setNodes(array $nodes)
55
+  {
56
+    if (isset($nodes[0]) && -1 === $nodes[0]->getLine())
57
+    {
58
+      $this->variables = null;
59
+    }
60
+    else
61
+    {
62
+      $this->variables = $nodes[0];
63
+    }
64
+  }
65
+
40 66
   public function getIncludedFile()
41 67
   {
42 68
     return $this->expr;