diff src/Kachkaev/JstmplBundle/Twig/JstmplNode.php @ 0:493bcb69166c

added public content
author Daniel Wolff
date Tue, 09 Feb 2016 20:54:02 +0100
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/Kachkaev/JstmplBundle/Twig/JstmplNode.php	Tue Feb 09 20:54:02 2016 +0100
@@ -0,0 +1,19 @@
+<?php
+
+namespace Kachkaev\JstmplBundle\Twig;
+
+class JstmplNode extends \Twig_Node
+{
+    public function __construct($id, \Twig_Node $body, $lineno)
+    {
+        parent::__construct(array('body' => $body), array('id' => $id), $lineno);
+    }
+
+    public function compile(\Twig_Compiler $compiler)
+    {
+        $compiler->addDebugInfo($this);
+        $compiler->write("	echo \"<script id=\\\"".$this->getAttribute('id')."\\\" type=\\\"text/html\\\">\";\n");
+        $compiler->subcompile($this->getNode('body'));
+        $compiler->write("	echo \"</script>\\n\\n\";\n");
+    }
+}
\ No newline at end of file