TwigRenderer.php 1004 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  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\Form;
  11. use Symfony\Component\Form\FormRenderer;
  12. use Symfony\Component\Security\Csrf\CsrfTokenManagerInterface;
  13. use Twig\Environment;
  14. /**
  15. * @author Bernhard Schussek <bschussek@gmail.com>
  16. */
  17. class TwigRenderer extends FormRenderer implements TwigRendererInterface
  18. {
  19. /**
  20. * @var TwigRendererEngineInterface
  21. */
  22. private $engine;
  23. public function __construct(TwigRendererEngineInterface $engine, CsrfTokenManagerInterface $csrfTokenManager = null)
  24. {
  25. parent::__construct($engine, $csrfTokenManager);
  26. $this->engine = $engine;
  27. }
  28. /**
  29. * {@inheritdoc}
  30. */
  31. public function setEnvironment(Environment $environment)
  32. {
  33. $this->engine->setEnvironment($environment);
  34. }
  35. }