app/Customize/Form/Type/Front/QuestionType.php line 25

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\RepeatedEmailType;
  15. use Symfony\Component\Form\AbstractType;
  16. use Symfony\Component\Form\Extension\Core\Type\TextareaType;
  17. use Symfony\Component\Form\FormBuilderInterface;
  18. use Symfony\Component\Validator\Constraints as Assert;
  19. use Symfony\Component\Form\Extension\Core\Type\TextType;
  20. use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
  21. class QuestionType extends AbstractType
  22. {
  23.     /**
  24.      * @var EccubeConfig
  25.      */
  26.     protected $eccubeConfig;
  27.     /**
  28.      * ContactType constructor.
  29.      *
  30.      * @param EccubeConfig $eccubeConfig
  31.      */
  32.     public function __construct(EccubeConfig $eccubeConfig)
  33.     {
  34.         $this->eccubeConfig $eccubeConfig;
  35.     }
  36.     /**
  37.      * {@inheritdoc}
  38.      */
  39.     public function buildForm(FormBuilderInterface $builder, array $options)
  40.     {
  41.         $builder
  42.             ->add('user_name'TextType::class, [
  43.                 'constraints' => [
  44.                     new Assert\NotBlank(),
  45.                     new Assert\Regex([
  46.                         'pattern' => '/^[^\s ]+$/u',
  47.                     ]),
  48.                 ],
  49.             ])
  50.             ->add('mail'RepeatedEmailType::class)
  51.             ->add('question'TextareaType::class, [
  52.                 'constraints' => [
  53.                     new Assert\NotBlank(),
  54.                 ],
  55.             ])
  56.             ->add('melmaga'CheckboxType::class, [
  57.                 'required' => false,
  58.                 'label' => 'ランドマークからのメールマガジンを購読する',
  59.             ])
  60.             ->add('g-recaptcha-response');
  61.     }
  62.     /**
  63.      * {@inheritdoc}
  64.      */
  65.     public function getBlockPrefix()
  66.     {
  67.         return 'question';
  68.     }
  69. }