src/Eccube/Form/Type/Front/NonMemberType.php line 28

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of EC-CUBE
  4.  *
  5.  * Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved.
  6.  *
  7.  * http://www.ec-cube.co.jp/
  8.  *
  9.  * For the full copyright and license information, please view the LICENSE
  10.  * file that was distributed with this source code.
  11.  */
  12. namespace Eccube\Form\Type\Front;
  13. use Eccube\Common\EccubeConfig;
  14. use Eccube\Form\Type\AddressType;
  15. use Eccube\Form\Type\KanaType;
  16. use Eccube\Form\Type\NameType;
  17. use Eccube\Form\Type\PhoneNumberType;
  18. use Eccube\Form\Type\PostalType;
  19. use Eccube\Form\Type\RepeatedEmailType;
  20. use Symfony\Component\Form\AbstractType;
  21. use Symfony\Component\Form\Extension\Core\Type\TextType;
  22. use Symfony\Component\Form\FormBuilderInterface;
  23. use Symfony\Component\Validator\Constraints as Assert;
  24. class NonMemberType extends AbstractType
  25. {
  26.     /**
  27.      * @var EccubeConfig
  28.      */
  29.     protected $eccubeConfig;
  30.     /**
  31.      * NonMemberType constructor.
  32.      *
  33.      * @param EccubeConfig $eccubeConfig
  34.      */
  35.     public function __construct(EccubeConfig $eccubeConfig)
  36.     {
  37.         $this->eccubeConfig $eccubeConfig;
  38.     }
  39.     /**
  40.      * {@inheritdoc}
  41.      */
  42.     public function buildForm(FormBuilderInterface $builder, array $options)
  43.     {
  44.         $builder
  45.             ->add('name'NameType::class, [
  46.                 'required' => true,
  47.             ])
  48.             ->add('kana'KanaType::class, [
  49.                 'required' => true,
  50.             ])
  51.             ->add('company_name'TextType::class, [
  52.                 'required' => false,
  53.                 'constraints' => [
  54.                     new Assert\Length([
  55.                         'max' => $this->eccubeConfig['eccube_stext_len'],
  56.                     ]),
  57.                 ],
  58.             ])
  59.             ->add('postal_code'PostalType::class, [
  60.                 'required' => true,
  61.             ])
  62.             ->add('address'AddressType::class, [
  63.                 'required' => true,
  64.             ])
  65.             ->add('phone_number'PhoneNumberType::class, [
  66.                 'required' => true,
  67.             ])
  68.             ->add('email'RepeatedEmailType::class);
  69.     }
  70.     /**
  71.      * {@inheritdoc}
  72.      */
  73.     public function getBlockPrefix()
  74.     {
  75.         return 'nonmember';
  76.     }
  77. }