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

Open in your IDE?
  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 $requestHandler;
  22.     public function __construct(RequestHandlerInterface $requestHandler null)
  23.     {
  24.         $this->requestHandler $requestHandler ?? new HttpFoundationRequestHandler();
  25.     }
  26.     /**
  27.      * {@inheritdoc}
  28.      */
  29.     public function buildForm(FormBuilderInterface $builder, array $options)
  30.     {
  31.         $builder->setRequestHandler($this->requestHandler);
  32.     }
  33.     /**
  34.      * {@inheritdoc}
  35.      */
  36.     public static function getExtendedTypes(): iterable
  37.     {
  38.         return [FormType::class];
  39.     }
  40. }