FormThemeNode.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Bridge\Twig\Node;
  11. /**
  12. * @author Fabien Potencier <fabien@symfony.com>
  13. */
  14. class FormThemeNode extends \Twig_Node
  15. {
  16. public function __construct(\Twig_NodeInterface $form, \Twig_NodeInterface $resources, $lineno, $tag = null)
  17. {
  18. parent::__construct(array('form' => $form, 'resources' => $resources), array(), $lineno, $tag);
  19. }
  20. /**
  21. * Compiles the node to PHP.
  22. *
  23. * @param \Twig_Compiler $compiler A Twig_Compiler instance
  24. */
  25. public function compile(\Twig_Compiler $compiler)
  26. {
  27. $compiler
  28. ->addDebugInfo($this)
  29. ->write('$this->env->getExtension(\'form\')->renderer->setTheme(')
  30. ->subcompile($this->getNode('form'))
  31. ->raw(', ')
  32. ->subcompile($this->getNode('resources'))
  33. ->raw(");\n");
  34. ;
  35. }
  36. }