<?php
/*
* This file is part of EC-CUBE
*
* Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved.
*
* http://www.ec-cube.co.jp/
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Customize\Form\Type\Front;
use Eccube\Common\EccubeConfig;
use Eccube\Form\Type\RepeatedEmailType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
class QuestionType extends AbstractType
{
/**
* @var EccubeConfig
*/
protected $eccubeConfig;
/**
* ContactType constructor.
*
* @param EccubeConfig $eccubeConfig
*/
public function __construct(EccubeConfig $eccubeConfig)
{
$this->eccubeConfig = $eccubeConfig;
}
/**
* {@inheritdoc}
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('user_name', TextType::class, [
'constraints' => [
new Assert\NotBlank(),
new Assert\Regex([
'pattern' => '/^[^\s ]+$/u',
]),
],
])
->add('mail', RepeatedEmailType::class)
->add('question', TextareaType::class, [
'constraints' => [
new Assert\NotBlank(),
],
])
->add('melmaga', CheckboxType::class, [
'required' => false,
'label' => 'ランドマークからのメールマガジンを購読する',
])
->add('g-recaptcha-response');
}
/**
* {@inheritdoc}
*/
public function getBlockPrefix()
{
return 'question';
}
}