vendor/symfony/form/Extension/HttpFoundation/Type/FormTypeHttpFoundationExtension.php line 27

  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\Form\Extension\HttpFoundation\Type;
  11. use Symfony\Component\Form\AbstractTypeExtension;
  12. use Symfony\Component\Form\Extension\Core\Type\FormType;
  13. use Symfony\Component\Form\Extension\HttpFoundation\HttpFoundationRequestHandler;
  14. use Symfony\Component\Form\FormBuilderInterface;
  15. use Symfony\Component\Form\RequestHandlerInterface;
  16. /**
  17.  * @author Bernhard Schussek <bschussek@gmail.com>
  18.  */
  19. class FormTypeHttpFoundationExtension extends AbstractTypeExtension
  20. {
  21.     private RequestHandlerInterface $requestHandler;
  22.     public function __construct(RequestHandlerInterface $requestHandler null)
  23.     {
  24.         $this->requestHandler $requestHandler ?? new HttpFoundationRequestHandler();
  25.     }
  26.     public function buildForm(FormBuilderInterface $builder, array $options)
  27.     {
  28.         $builder->setRequestHandler($this->requestHandler);
  29.     }
  30.     public static function getExtendedTypes(): iterable
  31.     {
  32.         return [FormType::class];
  33.     }
  34. }