$body); $attributes = array( 'source_urls' => $sourceUrls, 'target_url' => $targetUrl, 'filter_names' => $filterNames, 'asset_name' => $assetName, 'debug' => $debug, ); parent::__construct($nodes, $attributes, $lineno, $tag); } public function compile(\Twig_Compiler $compiler) { $body = $this->getNode('body'); $compiler ->addDebugInfo($this) ->write("\$context['asset_url'] = ") ->subcompile($this->getAssetUrlNode($body)) ->raw(";\n") ->subcompile($body) ->write("unset(\$context['asset_url']);\n") ; } protected function getAssetUrlNode(\Twig_NodeInterface $body) { return new \Twig_Node_Expression_Constant($this->getAttribute('target_url'), $body->getLine()); } }