4 * This file is part of the Symfony package.
6 * (c) Fabien Potencier <fabien@symfony.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Symfony\Bridge\Twig\Node
;
15 * Compiles a call to {@link FormRendererInterface::renderBlock()}.
17 * The function name is used as block name. For example, if the function name
18 * is "foo", the block "foo" will be rendered.
20 * @author Bernhard Schussek <bschussek@gmail.com>
22 class RenderBlockNode
extends \Twig_Node_Expression_Function
24 public function compile(\Twig_Compiler
$compiler)
26 $compiler->addDebugInfo($this);
27 $arguments = iterator_to_array($this->getNode('arguments'));
28 $compiler->write('$this->env->getExtension(\'form\')->renderer->renderBlock(');
30 if (isset($arguments[0])) {
31 $compiler->subcompile($arguments[0]);
32 $compiler->raw(', \'' . $this->getAttribute('name') . '\'');
34 if (isset($arguments[1])) {
36 $compiler->subcompile($arguments[1]);