src/Eccube/Form/Type/Front/ContactType.php line 33

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\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. use Symfony\Component\Form\Extension\Core\Type\DateType;
  28. class ContactType extends AbstractType
  29. {
  30.     /**
  31.      * @var EccubeConfig
  32.      */
  33.     protected $eccubeConfig;
  34.     /**
  35.      * ContactType constructor.
  36.      *
  37.      * @param EccubeConfig $eccubeConfig
  38.      */
  39.     public function __construct(EccubeConfig $eccubeConfig)
  40.     {
  41.         $this->eccubeConfig $eccubeConfig;
  42.     }
  43.     /**
  44.      * {@inheritdoc}
  45.      */
  46.     public function buildForm(FormBuilderInterface $builder, array $options)
  47.     {
  48.         $builder
  49.             ->add('name'NameType::class, [
  50.                 'required' => true,
  51.             ])
  52.             ->add(
  53.                 'country',ChoiceType::class,
  54.                 [
  55.                     'choices'  => array(
  56.                         'Albania' => 'Albania',
  57.                         'Algeria' => 'Algeria',
  58.                         'Argentina' => 'Argentina',
  59.                         'Aruba' => 'Aruba',
  60.                         'Australia' => 'Australia',
  61.                         'Austria' => 'Austria',
  62.                         'Bangladesh' => 'Bangladesh',
  63.                         'Barbados' => 'Barbados',
  64.                         'Belgium' => 'Belgium',
  65.                         'Benin' => 'Benin',
  66.                         'Botswana' => 'Botswana',
  67.                         'Bulgaria' => 'Bulgaria',
  68.                         'Burkina Faso' => 'Burkina Faso',
  69.                         'Cambodia' => 'Cambodia',
  70.                         'Canada' => 'Canada',
  71.                         'Cayman Islands' => 'Cayman Islands',
  72.                         'Central African Republic' => 'Central African Republic',
  73.                         'Chile' => 'Chile',
  74.                         'China' => 'China',
  75.                         'Cote d\'Ivoire' => 'Cote d\'Ivoire',
  76.                         'Cuba' => 'Cuba',
  77.                         'Curacao' => 'Curacao',
  78.                         'Cyprus' => 'Cyprus',
  79.                         'Czech Republic' => 'Czech Republic',
  80.                         'Democratic Republic of the Congo' => 'Democratic Republic of the Congo',
  81.                         'Denmark' => 'Denmark',
  82.                         'Dominican' => 'Dominican',
  83.                         'Ecuador' => 'Ecuador',
  84.                         'Egypt' => 'Egypt',
  85.                         'Fiji' => 'Fiji',
  86.                         'Finland' => 'Finland',
  87.                         'France' => 'France',
  88.                         'French Overseas Territories' => 'French Overseas Territories',
  89.                         'Georgia' => 'Georgia',
  90.                         'Ghana' => 'Ghana',
  91.                         'Gibraltar' => 'Gibraltar',
  92.                         'Greece' => 'Greece',
  93.                         'Guatemala' => 'Guatemala',
  94.                         'Guernsey' => 'Guernsey',
  95.                         'Haiti' => 'Haiti',
  96.                         'Hong Kong' => 'Hong Kong',
  97.                         'Hungary' => 'Hungary',
  98.                         'Iceland' => 'Iceland',
  99.                         'India' => 'India',
  100.                         'Ireland' => 'Ireland',
  101.                         'Isle of Man' => 'Isle of Man',
  102.                         'Israel' => 'Israel',
  103.                         'Italy' => 'Italy',
  104.                         'Jamaica' => 'Jamaica',
  105.                         'Japan' => 'Japan',
  106.                         'Jersey' => 'Jersey',
  107.                         'Jordan' => 'Jordan',
  108.                         'Kyrgyz Republic' => 'Kyrgyz Republic',
  109.                         'Laos' => 'Laos',
  110.                         'Lebanon' => 'Lebanon',
  111.                         'Lesotho' => 'Lesotho',
  112.                         'Luxembourg' => 'Luxembourg',
  113.                         'Macao' => 'Macao',
  114.                         'Madagascar' => 'Madagascar',
  115.                         'Malawi' => 'Malawi',
  116.                         'Malaysia' => 'Malaysia',
  117.                         'Mali' => 'Mali',
  118.                         'Malta' => 'Malta',
  119.                         'Monaco' => 'Monaco',
  120.                         'Montenegro' => 'Montenegro',
  121.                         'Morocco' => 'Morocco',
  122.                         'Namibia' => 'Namibia',
  123.                         'Netherlands' => 'Netherlands',
  124.                         'New Zealand' => 'New Zealand',
  125.                         'Niger' => 'Niger',
  126.                         'Nigeria' => 'Nigeria',
  127.                         'Norway' => 'Norway',
  128.                         'Papua New Guinea' => 'Papua New Guinea',
  129.                         'Paraguay' => 'Paraguay',
  130.                         'Peru' => 'Peru',
  131.                         'Philippines' => 'Philippines',
  132.                         'Poland' => 'Poland',
  133.                         'Portugal' => 'Portugal',
  134.                         'Republic of Korea' => 'Republic of Korea',
  135.                         'Republic of Lithuania' => 'Republic of Lithuania',
  136.                         'Republic of the Congo' => 'Republic of the Congo',
  137.                         'Romania' => 'Romania',
  138.                         'Russia' => 'Russia',
  139.                         'Rwanda' => 'Rwanda',
  140.                         'Saint Martin' => 'Saint Martin',
  141.                         'San Marino' => 'San Marino',
  142.                         'Senegal' => 'Senegal',
  143.                         'Serbia' => 'Serbia',
  144.                         'Sierra Leone' => 'Sierra Leone',
  145.                         'Singapore' => 'Singapore',
  146.                         'Slovakia' => 'Slovakia',
  147.                         'Slovenia' => 'Slovenia',
  148.                         'South Africa' => 'South Africa',
  149.                         'Spain' => 'Spain',
  150.                         'Sri Lanka' => 'Sri Lanka',
  151.                         'Sweden' => 'Sweden',
  152.                         'Syrian' => 'Syrian',
  153.                         'Territories of the United States' => 'Territories of the United States',
  154.                         'Thailand' => 'Thailand',
  155.                         'Togo' => 'Togo',
  156.                         'Trinidad and Tobago' => 'Trinidad and Tobago',
  157.                         'Tunisia' => 'Tunisia',
  158.                         'Turkey' => 'Turkey',
  159.                         'Uganda' => 'Uganda',
  160.                         'United Arab Emirates' => 'United Arab Emirates',
  161.                         'United Kingdom' => 'United Kingdom',
  162.                         'United States' => 'United States',
  163.                         'Vatican' => 'Vatican',
  164.                         'Venezuela' => 'Venezuela',
  165.                         'Zimbabwe' => 'Zimbabwe',
  166.                         'Other' => 'Other',
  167.                     ),
  168.                     'required' => true,
  169.                 ]
  170.             )
  171.             ->add('phone_number'PhoneNumberType::class, [
  172.                 'required' => false,
  173.             ])
  174.             ->add('email'EmailType::class, [
  175.                 'constraints' => [
  176.                     new Assert\NotBlank(),
  177.                     new Email(nullnull$this->eccubeConfig['eccube_rfc_email_check'] ? 'strict' null),
  178.                 ],
  179.             ])
  180.             ->add('inquiry_category'ChoiceType::class,[
  181.                 'choices' => [
  182.                   trans('admin.contact.inquiry_category1') => 1,
  183.                   trans('admin.contact.inquiry_category2') => 2,
  184.                   trans('admin.contact.inquiry_category3') => 3,
  185.                   trans('admin.contact.inquiry_category4') => 4,
  186.                   trans('admin.contact.inquiry_category5') => 5,
  187.                 ],
  188.                 'required' => false,
  189.                 'expanded' => true,
  190.                 'label' => trans('admin.contact.inquiry_category'),
  191.             ])
  192.             ->add('use_car1',ChoiceType::class,
  193.                 [
  194.                     'choices'  => $this->getCarList(),
  195.                     'required' => false,
  196.                 ]
  197.             )
  198.             ->add('use_car2',ChoiceType::class,
  199.                 [
  200.                     'choices'  => $this->getCarList(),
  201.                     'required' => false,
  202.                 ]
  203.             )
  204.             ->add('use_car3',ChoiceType::class,
  205.                 [
  206.                     'choices'  => $this->getCarList(),
  207.                     'required' => false,
  208.                 ]
  209.             )
  210.             ->add('date_start'DateType::class, [
  211.                 'label' => 'admin.order.order_date__start',
  212.                 'required' => false,
  213.                 'input' => 'datetime',
  214.                 'widget' => 'single_text',
  215.                 'format' => 'yyyy-MM-dd',
  216.                 'placeholder' => ['year' => '----''month' => '--''day' => '--'],
  217.                 'attr' => [
  218.                     'class' => 'datetimepicker-input',
  219.                     'data-target' => '#'.$this->getBlockPrefix().'_order_date_start',
  220.                     'data-toggle' => 'datetimepicker',
  221.                 ],
  222.             ])
  223.             ->add('date_end'DateType::class, [
  224.                 'label' => 'admin.order.order_date__start',
  225.                 'required' => false,
  226.                 'input' => 'datetime',
  227.                 'widget' => 'single_text',
  228.                 'format' => 'yyyy-MM-dd',
  229.                 'placeholder' => ['year' => '----''month' => '--''day' => '--'],
  230.                 'attr' => [
  231.                     'class' => 'datetimepicker-input',
  232.                     'data-target' => '#'.$this->getBlockPrefix().'_order_date_start',
  233.                     'data-toggle' => 'datetimepicker',
  234.                 ],
  235.             ])
  236.             ->add('contents'TextareaType::class, [
  237.                 'constraints' => [
  238.                     new Assert\NotBlank(),
  239.                     new Assert\Length([
  240.                         'max' => $this->eccubeConfig['eccube_lltext_len'],
  241.                     ])
  242.                 ],
  243.             ]);
  244.     }
  245.     /**
  246.      * {@inheritdoc}
  247.      */
  248.     public function getBlockPrefix()
  249.     {
  250.         return 'contact';
  251.     }
  252.     
  253.     private function getCarList() {
  254.     
  255.         return array(
  256.             'Alpha Romeo 8C' => 'Alpha Romeo 8C',
  257.             'AQUA RIVA 33' => 'AQUA RIVA 33',
  258.             'Aston Martin DB11 volante' => 'Aston Martin DB11 volante',
  259.             'AW109' => 'AW109',
  260.             'AZIMUT 80' => 'AZIMUT 80',
  261.             'Bell 505' => 'Bell 505',
  262.             'Bentley Bentayga' => 'Bentley Bentayga',
  263.             'Chevrolet Corvet Grand Sports' => 'Chevrolet Corvet Grand Sports',
  264.             'Ferrari 488 Pista' => 'Ferrari 488 Pista',
  265.             'Ferrari California T' => 'Ferrari California T',
  266.             'Ferrari Dino 308 GT4' => 'Ferrari Dino 308 GT4',
  267.             'Honda S2000 2.2' => 'Honda S2000 2.2',
  268.             'Jaguar E type sl.1' => 'Jaguar E type sl.1',
  269.             'Lamborghini Huracan EVO' => 'Lamborghini Huracan EVO',
  270.             'Lamborghini Huracan Spyder' => 'Lamborghini Huracan Spyder',
  271.             'Lamborghini Urus' => 'Lamborghini Urus',
  272.             'McLaren GT' => 'McLaren GT',
  273.             'Mercedes Benz AMG G63' => 'Mercedes Benz AMG G63',
  274.             'Mercedes Benz AMG G63' => 'Mercedes Benz AMG G63',
  275.             'Mercedes Benz AMG SLS' => 'Mercedes Benz AMG SLS',
  276.             'Mercedes Benz G350D' => 'Mercedes Benz G350D',
  277.             'Mercedes Benz MAYBACH S650' => 'Mercedes Benz MAYBACH S650',
  278.             'Mercedes G63 BRABUS WIDE STAR' => 'Mercedes G63 BRABUS WIDE STAR',
  279.             'Mercedes-Benz 280SL' => 'Mercedes-Benz 280SL',
  280.             'Mersedes Benz Maclaren SLR' => 'Mersedes Benz Maclaren SLR',
  281.             'NISSAN GT-R NISMO' => 'NISSAN GT-R NISMO',
  282.             'PORCHE 911' => 'PORCHE 911',
  283.             'Porche 997 Speed Star' => 'Porche 997 Speed Star',
  284.             'Porche Cayen S' => 'Porche Cayen S',
  285.             'Porche Cayen Turbo' => 'Porche Cayen Turbo',
  286.             'Porche GT3' => 'Porche GT3',
  287.             'Porche Panamera GTS' => 'Porche Panamera GTS',
  288.             'Porsche 356A/1600super' => 'Porsche 356A/1600super',
  289.             'PRINCESS F49' => 'PRINCESS F49',
  290.             'Sun seeker 86' => 'Sun seeker 86',
  291.         );
  292.     
  293.     }
  294. }