src/Form/ContactType.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Form;
  3. use Symfony\Component\Form\AbstractType;
  4. use Symfony\Component\Form\Extension\Core\Type\TextareaType;
  5. use Symfony\Component\Form\Extension\Core\Type\TextType;
  6. use Symfony\Component\Form\FormBuilderInterface;
  7. use Symfony\Component\OptionsResolver\OptionsResolver;
  8. class ContactType extends AbstractType
  9. {
  10.     /**
  11.      * {@inheritdoc}
  12.      */
  13.     public function buildForm(FormBuilderInterface $builder, array $options)
  14.     {
  15.         $builder
  16.             ->add('name'TextType::class, [
  17.                 "label" => "contact.name"
  18.             ])
  19.             ->add('email'TextType::class, [
  20.                 "label" => "contact.email"
  21.             ])
  22.             ->add('phone'TextType::class, [
  23.                 "label" => "contact.phone"
  24.             ])
  25.             ->add('message'TextareaType::class, [
  26.                 "label" => "contact.message"
  27.             ]);
  28.     }
  29.     /**
  30.      * {@inheritdoc}
  31.      */
  32.     public function configureOptions(OptionsResolver $resolver)
  33.     {
  34.         $resolver->setDefaults(array(
  35.             'translation_domain' => 'messages',
  36.             'data_class' => 'App\Entity\Contact'
  37.         ));
  38.     }
  39.     /**
  40.      * {@inheritdoc}
  41.      */
  42.     public function getBlockPrefix()
  43.     {
  44.         return 'contactbundle_contact';
  45.     }
  46. }