From 473d0c32a2cd4abd514f87950e8b254e797ffc7e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rapha=C3=ABl=20Gertz?= Date: Tue, 26 Nov 2019 13:34:47 +0100 Subject: [PATCH] Cleanup --- Twig/PackNode.php | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/Twig/PackNode.php b/Twig/PackNode.php index 4f08be0..79e8e41 100644 --- a/Twig/PackNode.php +++ b/Twig/PackNode.php @@ -1,25 +1,15 @@ $value), array('name' => $name), $line, $tag); - #} - public function __construct(array $nodes = array(), array $attributes = array(), $lineno = 0, $tag = null) { - parent::__construct($nodes, $attributes, $lineno, $tag); - #$this->output = $attributes['output']; - #$this->setAttribute($this->getAttribute('name'), $attributes['name']); - } - public function compile(\Twig_Compiler $compiler) { +namespace Rapsys\PackBundle\Twig; - #header('Content-Type: text/plain'); - #var_dump($this->getNode(0)); - #var_dump($this->attributes); - #var_dump($compiler->subcompile($this->getNode(0))); - #exit; - #$compiler->addDebugInfo($this)->write('echo \'
'.json_encode(array('nodes' => $this->nodes, 'attributes' => $this->attributes)).'
\';'); +class PackNode extends \Twig\Node\Node { + /** + * Compile the body node + * + * @param $compiler + */ + public function compile(\Twig\Compiler $compiler) { + //Add $context[''] = ''; in twig template $compiler ->addDebugInfo($this) ->write('$context[\''.$this->getAttribute('name').'\'] = ') -- 2.41.1