vendor/symfony/src/Symfony/Bundle/TwigBundle/Node/RenderNode.php
changeset 0 7f95f8617b0b
equal deleted inserted replaced
-1:000000000000 0:7f95f8617b0b
       
     1 <?php
       
     2 
       
     3 /*
       
     4  * This file is part of the Symfony package.
       
     5  *
       
     6  * (c) Fabien Potencier <fabien@symfony.com>
       
     7  *
       
     8  * For the full copyright and license information, please view the LICENSE
       
     9  * file that was distributed with this source code.
       
    10  */
       
    11 
       
    12 namespace Symfony\Bundle\TwigBundle\Node;
       
    13 
       
    14 /**
       
    15  * Represents a render node.
       
    16  *
       
    17  * @author Fabien Potencier <fabien@symfony.com>
       
    18  */
       
    19 class RenderNode extends \Twig_Node
       
    20 {
       
    21     public function __construct(\Twig_Node_Expression $expr, \Twig_Node_Expression $attributes, \Twig_Node_Expression $options, $lineno, $tag = null)
       
    22     {
       
    23         parent::__construct(array('expr' => $expr, 'attributes' => $attributes, 'options' => $options), array(), $lineno, $tag);
       
    24     }
       
    25 
       
    26     /**
       
    27      * Compiles the node to PHP.
       
    28      *
       
    29      * @param \Twig_Compiler $compiler A Twig_Compiler instance
       
    30      */
       
    31     public function compile(\Twig_Compiler $compiler)
       
    32     {
       
    33         $compiler
       
    34             ->addDebugInfo($this)
       
    35             ->write("echo \$this->env->getExtension('actions')->renderAction(")
       
    36             ->subcompile($this->getNode('expr'))
       
    37             ->raw(', ')
       
    38             ->subcompile($this->getNode('attributes'))
       
    39             ->raw(', ')
       
    40             ->subcompile($this->getNode('options'))
       
    41             ->raw(");\n")
       
    42         ;
       
    43     }
       
    44 }