<?php
namespace App\Form\Contact;
use App\Entity\Contact\Data;
use App\Form\Traits\InquiryTypeTrait;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\TelType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use TripleE\Utilities\FormBuildHelperTrait;
class DataType extends AbstractType
{
use InquiryTypeTrait;
use FormBuildHelperTrait;
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$this->addRequiredTypes($builder);
$this
->addTextType(
$builder, "name", "お名前", true, 255
)
->addTextType(
$builder, "kana", "ふりがな", true, 255
)
->addTextType(
$builder, "phone", "電話番号", false, 255,
typeName: TelType::class
)
->addTextType(
$builder, "message", "お問合せ内容", true, typeName: TextareaType::class
)
;
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => Data::class,
]);
}
}