app/Plugin/PiaContact/Form/Type/CoinsFromBarsType.php line 15

Open in your IDE?
  1. <?php
  2. namespace Plugin\PiaContact\Form\Type;
  3. use Eccube\Common\EccubeConfig;
  4. use Eccube\Form\Type\NameType;
  5. use Eccube\Form\Type\PhoneNumberType;
  6. use Symfony\Component\Form\AbstractType;
  7. use Symfony\Component\Form\Extension\Core\Type\EmailType;
  8. use Symfony\Component\Form\Extension\Core\Type\TextareaType;
  9. use Symfony\Component\Form\Extension\Core\Type\TextType;
  10. use Symfony\Component\Form\FormBuilderInterface;
  11. use Symfony\Component\Validator\Constraints as Assert;
  12. class CoinsFromBarsType extends AbstractType
  13. {
  14.     /**
  15.      * @var EccubeConfig
  16.      */
  17.     protected $eccubeConfig;
  18.     public function __construct(EccubeConfig $eccubeConfig)
  19.     {
  20.         $this->eccubeConfig $eccubeConfig;
  21.     }
  22.     /**
  23.      * {@inheritdoc}
  24.      */
  25.     public function buildForm(FormBuilderInterface $builder, array $options)
  26.     {
  27.         $builder
  28.             ->add('weight'TextType::class, [
  29.                 'label' => '売却希望重量',
  30.                 'required' => false,
  31.                 'attr' => [
  32.                     'placeholder' => '例:1kg、500g等',
  33.                 ],
  34.             ])
  35.             ->add('coin_num'TextType::class, [
  36.                 'label' => '購入希望コインの枚数',
  37.                 'required' => false,
  38.                 'attr' => [
  39.                     'placeholder' => '例:10枚、50枚等',
  40.                 ],
  41.             ])
  42.             ->add('name'NameType::class, [
  43.                 'required' => true,
  44.             ])
  45.             ->add('email'EmailType::class, [
  46.                 'required' => true,
  47.                 'constraints' => [
  48.                     new Assert\NotBlank(),
  49.                     new Assert\Email(),
  50.                 ],
  51.             ])
  52.             ->add('tel'PhoneNumberType::class, [
  53.                 'required' => true,
  54.             ])
  55.             ->add('inquiries'TextareaType::class, [
  56.                 'label' => 'その他問い合わせ',
  57.                 'required' => false,
  58.                 'attr' => [
  59.                     'rows' => 5,
  60.                     'placeholder' => 'ご質問やご要望がございましたらご記入ください',
  61.                 ],
  62.             ]);
  63.     }
  64.     /**
  65.      * {@inheritdoc}
  66.      */
  67.     public function getBlockPrefix()
  68.     {
  69.         return 'coins_from_bars';
  70.     }
  71. }