vendor/symfony/twig-bridge/Node/FormThemeNode.php line 23

  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. use Symfony\Component\Form\FormRenderer;
  12. use Twig\Compiler;
  13. use Twig\Node\Node;
  14. /**
  15.  * @author Fabien Potencier <fabien@symfony.com>
  16.  */
  17. final class FormThemeNode extends Node
  18. {
  19.     public function __construct(Node $formNode $resourcesint $linenostring $tag nullbool $only false)
  20.     {
  21.         parent::__construct(['form' => $form'resources' => $resources], ['only' => $only], $lineno$tag);
  22.     }
  23.     public function compile(Compiler $compiler): void
  24.     {
  25.         $compiler
  26.             ->addDebugInfo($this)
  27.             ->write('$this->env->getRuntime(')
  28.             ->string(FormRenderer::class)
  29.             ->raw(')->setTheme(')
  30.             ->subcompile($this->getNode('form'))
  31.             ->raw(', ')
  32.             ->subcompile($this->getNode('resources'))
  33.             ->raw(', ')
  34.             ->raw(false === $this->getAttribute('only') ? 'true' 'false')
  35.             ->raw(");\n");
  36.     }
  37. }