app/Plugin/PiaContact/Form/Type/SellGoldBarsType.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 SellGoldBarsType 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('name'NameType::class, [
  36.                 'required' => true,
  37.             ])
  38.             ->add('email'EmailType::class, [
  39.                 'required' => true,
  40.                 'constraints' => [
  41.                     new Assert\NotBlank(),
  42.                     new Assert\Email(),
  43.                 ],
  44.             ])
  45.             ->add('tel'PhoneNumberType::class, [
  46.                 'required' => true,
  47.             ])
  48.             ->add('inquiries'TextareaType::class, [
  49.                 'label' => 'その他問い合わせ',
  50.                 'required' => false,
  51.                 'attr' => [
  52.                     'rows' => 5,
  53.                     'placeholder' => 'ご質問やご要望がございましたらご記入ください',
  54.                 ],
  55.             ]);
  56.     }
  57.     /**
  58.      * {@inheritdoc}
  59.      */
  60.     public function getBlockPrefix()
  61.     {
  62.         return 'sell_gold_bars';
  63.     }
  64. }