[ Index ]

PHP Cross Reference of phpBB-3.3.14-deutsch

title

Body

[close]

/vendor/symfony/twig-bridge/Node/ -> FormThemeNode.php (source)

   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  use Symfony\Bridge\Twig\Form\TwigRenderer;
  15  use Symfony\Component\Form\FormRenderer;
  16  use Twig\Compiler;
  17  use Twig\Error\RuntimeError;
  18  use Twig\Node\Node;
  19  
  20  /**
  21   * @author Fabien Potencier <fabien@symfony.com>
  22   */
  23  class FormThemeNode extends Node
  24  {
  25      public function __construct(Node $form, Node $resources, $lineno, $tag = null, $only = false)
  26      {
  27          parent::__construct(['form' => $form, 'resources' => $resources], ['only' => (bool) $only], $lineno, $tag);
  28      }
  29  
  30      public function compile(Compiler $compiler)
  31      {
  32          try {
  33              $compiler->getEnvironment()->getRuntime(FormRenderer::class);
  34              $renderer = FormRenderer::class;
  35          } catch (RuntimeError $e) {
  36              $renderer = TwigRenderer::class;
  37          }
  38  
  39          $compiler
  40              ->addDebugInfo($this)
  41              ->write('$this->env->getRuntime(')
  42              ->string($renderer)
  43              ->raw(')->setTheme(')
  44              ->subcompile($this->getNode('form'))
  45              ->raw(', ')
  46              ->subcompile($this->getNode('resources'))
  47              ->raw(', ')
  48              ->raw(false === $this->getAttribute('only') ? 'true' : 'false')
  49              ->raw(");\n");
  50      }
  51  }


Generated: Mon Nov 25 19:05:08 2024 Cross-referenced by PHPXref 0.7.1