form.php 993 B

123456789101112131415161718192021222324252627282930
  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\Component\DependencyInjection\Loader\Configurator;
  11. use Symfony\Bridge\Twig\Extension\FormExtension;
  12. use Symfony\Bridge\Twig\Form\TwigRendererEngine;
  13. use Symfony\Component\Form\FormRenderer;
  14. return static function (ContainerConfigurator $container) {
  15. $container->services()
  16. ->set('twig.extension.form', FormExtension::class)
  17. ->args([service('translator')->nullOnInvalid()])
  18. ->set('twig.form.engine', TwigRendererEngine::class)
  19. ->args([param('twig.form.resources'), service('twig')])
  20. ->set('twig.form.renderer', FormRenderer::class)
  21. ->args([service('twig.form.engine'), service('security.csrf.token_manager')->nullOnInvalid()])
  22. ->tag('twig.runtime')
  23. ;
  24. };