vendor/symfony/src/Symfony/Bridge/Twig/Node/FormThemeNode.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\Bridge\Twig\Node;
       
    13 
       
    14 /**
       
    15  *
       
    16  *
       
    17  * @author Fabien Potencier <fabien@symfony.com>
       
    18  */
       
    19 class FormThemeNode extends \Twig_Node
       
    20 {
       
    21     public function __construct(\Twig_NodeInterface $form, \Twig_NodeInterface $resources, $lineno, $tag = null)
       
    22     {
       
    23         parent::__construct(array('form' => $form, 'resources' => $resources), 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(\'form\')->setTheme(')
       
    36             ->subcompile($this->getNode('form'))
       
    37             ->raw(', array(')
       
    38         ;
       
    39 
       
    40         foreach ($this->getNode('resources') as $resource) {
       
    41             $compiler
       
    42                 ->subcompile($resource)
       
    43                 ->raw(', ')
       
    44             ;
       
    45         }
       
    46 
       
    47         $compiler->raw("));\n");
       
    48     }
       
    49 }