src/Form/Extension/CustomerRegistrationTypeExtension.php line 31

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of the Sylius package.
  4.  *
  5.  * (c) Paweł Jędrzejewski
  6.  *
  7.  * For the full copyright and license information, please view the LICENSE
  8.  * file that was distributed with this source code.
  9.  */
  10. declare(strict_types=1);
  11. namespace BitBag\OpenMarketplace\Form\Extension;
  12. //use BitBag\OpenMarketplace\EventListener\CustomerRegistrationListener;
  13. use phpDocumentor\Reflection\Types\Boolean;
  14. use Sonata\Form\Type\BooleanType;
  15. use Sylius\Bundle\CoreBundle\Form\Type\Customer\CustomerRegistrationType;
  16. //use Sylius\Bundle\CoreBundle\Form\Type\Customer\CustomerSimpleRegistrationType;
  17. use Symfony\Component\Form\AbstractType;
  18. use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
  19. use Symfony\Component\Form\Extension\Core\Type\IntegerType;
  20. use Symfony\Component\Form\Extension\Core\Type\TelType;
  21. use Symfony\Component\Form\Extension\Core\Type\TextType;
  22. use Symfony\Component\Form\FormTypeInterface;
  23. use Symfony\Component\Form\AbstractTypeExtension;
  24. use Symfony\Component\Form\FormBuilderInterface;
  25. use Doctrine\ORM\EntityManager;
  26. final class CustomerRegistrationTypeExtension extends AbstractTypeExtension implements FormTypeInterface
  27. {
  28.     public function buildForm(FormBuilderInterface $builder, array $options = []): void
  29.     {
  30.         parent::buildForm($builder$options);
  31.         $builder
  32.             ->add('isVendor' CheckboxType::class, ['mapped' => false])
  33.             ->add('codePostal'TelType::class, [
  34.                 'label' => 'Code Postal',
  35.                 'required' => true,
  36.                 'attr' => [
  37.                     'maxlength' => '5'
  38.                 ],
  39.             ])
  40.             ->add('phoneNumber'TelType::class, [
  41.                 'label' => 'sylius.form.customer.phone_number',
  42.                 'required' => false,
  43.                 'attr' => [
  44.                     'maxlength' => '10'
  45.                 ],
  46.             ])
  47.             ->add('addressNumber'TelType::class,  [
  48.                 'label' => 'Numéro de l\'adresse',
  49.                 'required' => true
  50.             ])
  51.             ->add('addressName'TextType::class, [
  52.                 'label' => 'Nom de l\'adresse',
  53.                 'required' => true
  54.             ])
  55.             ->add('city'TextType::class, [
  56.                 'label' => 'Ville',
  57.                 'required' => true
  58.             ])
  59.             ->add('region'TextType::class, [
  60.                 'label' => 'Region',
  61.                 'required' => true
  62.             ])
  63.             ->add('termsMangoPay'CheckboxType::class, [
  64.                 'label' => 'Accepter les termes & les conditions de MangoPay',
  65.                 'required' => true
  66.             ])
  67.             ->add('subscribedToNewsletter'CheckboxType::class, ['mapped' => false])
  68.         ;
  69.     }
  70.     public static function getExtendedTypes(): iterable
  71.     {
  72.         return [CustomerRegistrationType::class];
  73.     }
  74.     public function getParent(): string
  75.     {
  76.         return CustomerRegistrationType::class;
  77.     }
  78.     public function getBlockPrefix(): string
  79.     {
  80.         return 'sylius_customer_registration';
  81.     }
  82. }