app/Customize/Form/Type/Front/Contact3Type.php line 31

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 Customize\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\Validator\Email;
  20. use Symfony\Component\Form\AbstractType;
  21. use Symfony\Component\Form\Extension\Core\Type\EmailType;
  22. use Symfony\Component\Form\Extension\Core\Type\TextareaType;
  23. use Symfony\Component\Form\FormBuilderInterface;
  24. use Symfony\Component\Validator\Constraints as Assert;
  25. use Symfony\Component\Form\Extension\Core\Type\TextType;
  26. use Symfony\Component\Form\Extension\Core\Type\ChoiceType//選択肢
  27. class Contact3Type extends AbstractType
  28. {
  29.     /**
  30.      * @var EccubeConfig
  31.      */
  32.     protected $eccubeConfig;
  33.     /**
  34.      * ContactType constructor.
  35.      *
  36.      * @param EccubeConfig $eccubeConfig
  37.      */
  38.     public function __construct(EccubeConfig $eccubeConfig)
  39.     {
  40.         $this->eccubeConfig $eccubeConfig;
  41.     }
  42.     /**
  43.      * {@inheritdoc}
  44.      */
  45.     public function buildForm(FormBuilderInterface $builder, array $options)
  46.     {
  47.         $builder
  48.             ->add('name'NameType::class, [
  49.                 'required' => true,
  50.             ])
  51.             ->add('phone_number'PhoneNumberType::class, [
  52.                 'required' => true,
  53.             ])
  54.             ->add('email'EmailType::class, [
  55.                 'constraints' => [
  56.                     new Assert\NotBlank(),
  57.                     new Email(nullnull$this->eccubeConfig['eccube_rfc_email_check'] ? 'strict' null),
  58.                 ],
  59.             ])
  60.             ->add('contents'TextareaType::class, [
  61.                 'required' => false,
  62.                 'constraints' => [
  63.                     // new Assert\NotBlank(),
  64.                     new Assert\Length([
  65.                         'max' => $this->eccubeConfig['eccube_lltext_len'],
  66.                     ])
  67.                 ],
  68.             ])
  69.             // カスタマイズ項目 ここから
  70.            // メニュー1
  71.             ->add('menu_1'ChoiceType::class, [
  72.                 'required' => true,
  73.                 'choices' => [
  74.                     "すべておまかせ" => "すべておまかせ",
  75.                     "一部指定したい" => "一部指定したい",
  76.                     "全部決めたい、確認して" => "全部決めたい、確認して",
  77.                 ],
  78.             ])
  79.             // cpu
  80.             ->add('cpu_head'ChoiceType::class, [
  81.                 'required' => false,
  82.                 'placeholder' => 'CPUモデル',
  83.                 'choices' => [
  84.                     "intel corei3" => "intel corei3",
  85.                     "intel corei5" => "intel corei5",
  86.                     "intel corei7" => "intel corei7",
  87.                     "intel corei9" => "intel corei9",
  88.                     "AMD Ryzen3" => "AMD Ryzen3",
  89.                     "AMD Ryzen5" => "AMD Ryzen5",
  90.                     "AMD Ryzen7" => "AMD Ryzen7",
  91.                     "AMD Ryzen9" => "AMD Ryzen9",
  92.                 ],
  93.             ])
  94.             // 型番(例:i7 13700Fやryzen5 3600XTなど
  95.             ->add('cpu_body'TextType::class, [
  96.                 'required' => false,
  97.                 'constraints' => [
  98.                     // new Assert\NotBlank(),
  99.                     new Assert\Length([
  100.                         'max' => 200,
  101.                     ])
  102.                 ],
  103.             ])
  104.             // cpuクーラー
  105.             ->add('cool'ChoiceType::class, [
  106.                 'required' => false,
  107.                 'placeholder' => 'CPUモデル',
  108.                 'choices' => [
  109.                     "空冷" => "空冷",
  110.                     "水冷" => "水冷",
  111.                 ],
  112.             ])
  113.             // ラジエーター長やメーカーなど
  114.             ->add('cool_body'TextType::class, [
  115.                 'required' => false,
  116.                 'constraints' => [
  117.                     // new Assert\NotBlank(),
  118.                     new Assert\Length([
  119.                         'max' => 200,
  120.                     ])
  121.                 ],
  122.             ])
  123.             // メモリの型番
  124.                         ->add('ram_head'ChoiceType::class, [
  125.                     'required' => false,
  126.                        'placeholder' => 'メモリモデル',
  127.                     'choices' => [
  128.                                "DDR4" => "DDR4",
  129.                                "DDR5" => "DDR5",
  130.                        ],
  131.                        ])
  132.             // メモリの容量
  133.             ->add('ram_body'ChoiceType::class, [
  134.                 'required' => false,
  135.                 'placeholder' => 'メモリの容量',
  136.                 'choices' => [
  137.                     "4GB" => "4GB",
  138.                     "8GB" => "8GB",
  139.                     "12GB" => "12GB",
  140.                     "16GB" => "16GB",
  141.                     "20GB" => "20GB",
  142.                     "24GB" => "24GB",
  143.                     "28GB" => "28GB",
  144.                     "32GB" => "32GB",
  145.                     "40GB" => "40GB",
  146.                     "64GB" => "64GB",
  147.                     "128GB" => "128GB",
  148.                     "これ以外は空欄へ記入" => "これ以外は空欄へ記入",
  149.                 ],
  150.             ])
  151.             // GB容量、定格周波数など
  152.             ->add('ram_other'TextType::class, [
  153.                 'required' => false,
  154.                 'constraints' => [
  155.                     // new Assert\NotBlank(),
  156.                     new Assert\Length([
  157.                         'max' => 200,
  158.                     ])
  159.                 ],
  160.             ])
  161.             // チップセット等わかる範囲
  162.             ->add('m_b'TextType::class, [
  163.                 'required' => false,
  164.                 'constraints' => [
  165.                     // new Assert\NotBlank(),
  166.                     new Assert\Length([
  167.                         'max' => 200,
  168.                     ])
  169.                 ],
  170.             ])
  171.             // グラフィックボード 型番(text):
  172.             ->add('gpu'TextType::class, [
  173.                 'required' => false,
  174.                 'constraints' => [
  175.                     // new Assert\NotBlank(),
  176.                     new Assert\Length([
  177.                         'max' => 200,
  178.                     ])
  179.                 ],
  180.             ])
  181.             // ストレージタイプ
  182.             ->add('storage1_type'ChoiceType::class, [
  183.                 'required' => false,
  184.                 'placeholder' => 'ストレージ形式',
  185.                 'choices' => [
  186.                     "SSD/NVMe" => "SSD/NVMe",
  187.                     "HDD" => "HDD",
  188.                 ],
  189.             ])
  190.             // ストレージ容量
  191.             ->add('storage1_vol'ChoiceType::class, [
  192.                 'required' => false,
  193.                 'placeholder' => 'ストレージ容量',
  194.                 'choices' => [
  195.                     "120GB以下" => "120GB以下",
  196.                     "240-256GB" => "240-256GB",
  197.                     "500-512GB" => "500-512GB",
  198.                     "960GB-1TB" => "960GB-1TB",
  199.                     "2TB" => "2TB",
  200.                     "4TB" => "4TB",
  201.                     "6TB" => "6TB",
  202.                 ],
  203.             ])
  204.             // ストレージタイプ
  205.             ->add('storage2_type'ChoiceType::class, [
  206.                 'required' => false,
  207.                 'placeholder' => 'ストレージ形式',
  208.                 'choices' => [
  209.                     "SSD" => "SSD",
  210.                     "m.2 NVMe" => "m.2 NVMe",
  211.                     "HDD" => "HDD",
  212.                 ],
  213.             ])
  214.             // ストレージ容量
  215.             ->add('storage2_vol'ChoiceType::class, [
  216.                 'required' => false,
  217.                 'placeholder' => 'ストレージ容量',
  218.                 'choices' => [
  219.                     "120GB以下" => "120GB以下",
  220.                     "240-256GB" => "240-256GB",
  221.                     "500-512GB" => "500-512GB",
  222.                     "960GB-1TB" => "960GB-1TB",
  223.                     "2TB" => "2TB",
  224.                     "4TB" => "4TB",
  225.                     "6TB" => "6TB",
  226.                 ],
  227.             ])
  228.             // ストレージその他
  229.             ->add('storage_other'TextType::class, [
  230.                 'required' => false,
  231.                 'constraints' => [
  232.                     // new Assert\NotBlank(),
  233.                     new Assert\Length([
  234.                         'max' => 200,
  235.                     ])
  236.                 ],
  237.             ])
  238.             // 電源容量
  239.             ->add('psu_vol'ChoiceType::class, [
  240.                 'required' => false,
  241.                 'placeholder' => '電源容量',
  242.                 'choices' => [
  243.                     "500W以下" => "500W以下",
  244.                     "550W" => "550W",
  245.                     "600W" => "600W",
  246.                     "650W" => "650W",
  247.                     "700W" => "700W",
  248.                     "750W" => "750W",
  249.                     "800W" => "800W",
  250.                     "850W" => "850W",
  251.                     "1000-1050W" => "1000-1050W",
  252.                     "1200W" => "1200W",
  253.                     "その他" => "その他",
  254.                 ],
  255.             ])
  256.             // 電源認証
  257.             ->add('psu_auth'ChoiceType::class, [
  258.                 'required' => false,
  259.                 'placeholder' => '認証',
  260.                 'choices' => [
  261.                     "80+Standard" => "80+Standard",
  262.                     "Bronze" => "Bronze",
  263.                     "Silver" => "Silver",
  264.                     "Gold" => "Gold",
  265.                     "Platinum" => "Platinum",
  266.                     "Titan" => "Titan",
  267.                 ],
  268.             ])
  269.             // 電源(その他)
  270.             ->add('psu_other'TextType::class, [
  271.                 'required' => false,
  272.                 'constraints' => [
  273.                     // new Assert\NotBlank(),
  274.                     new Assert\Length([
  275.                         'max' => 200,
  276.                     ])
  277.                 ],
  278.             ])
  279.             //PCケース
  280.             ->add('pc_case'TextType::class, [
  281.                 'required' => false,
  282.                 'constraints' => [
  283.                     // new Assert\NotBlank(),
  284.                     new Assert\Length([
  285.                         'max' => 200,
  286.                     ])
  287.                 ],
  288.             ])
  289.             // OS(タイプ)
  290.             ->add('os_type'ChoiceType::class, [
  291.                 'required' => false,
  292.                 'placeholder' => 'OS',
  293.                 'choices' => [
  294.                     "Windows10" => "Windows10",
  295.                     "Windows11" => "Windows11",
  296.                 ],
  297.             ])
  298.             ->add('os_edi'ChoiceType::class, [
  299.                 'required' => false,
  300.                 'placeholder' => 'エディション',
  301.                 'choices' => [
  302.                     "Home 64bit" => "Home 64bit",
  303.                     "Pro 64bit" => "Pro 64bit",
  304.                 ],
  305.             ])
  306.             ->add('os_other'TextType::class, [
  307.                 'required' => false,
  308.                 'constraints' => [
  309.                     // new Assert\NotBlank(),
  310.                     new Assert\Length([
  311.                         'max' => 200,
  312.                     ])
  313.                 ],
  314.             ])
  315.             ->add('contents2'TextareaType::class, [
  316.                 'required' => false,
  317.                 'constraints' => [
  318.                     // new Assert\NotBlank(),
  319.                     new Assert\Length([
  320.                         'max' => $this->eccubeConfig['eccube_lltext_len'],
  321.                     ])
  322.                 ],
  323.             ])
  324.             // 予算
  325.             ->add('price'ChoiceType::class, [
  326.                 'required' => true,
  327.                 'choices' => [
  328.                     "おまかせ(バランス重視)" => "おまかせ(バランス重視)",
  329.                     "とにかく安く" => "とにかく安く",
  330.                     "希望金額以下で" => "希望金額以下で",
  331.                 ],
  332.             ])
  333.             ->add('hope_price'TextType::class, [
  334.                 'required' => true,
  335.                 'constraints' => [
  336.                     new Assert\NotBlank(),
  337.                     new Assert\Length([
  338.                         'max' => 200,
  339.                     ])
  340.                 ],
  341.             ]);
  342.     }
  343.     /**
  344.      * {@inheritdoc}
  345.      */
  346.     public function getBlockPrefix()
  347.     {
  348.         return 'contact3';
  349.     }
  350. }