src/Form/LoginFormType.php line 21

Open in your IDE?
  1. <?php
  2. /**
  3.  * @file
  4.  *   Login form
  5.  */
  6. namespace App\Form;
  7. use Symfony\Component\Form\AbstractType;
  8. use Symfony\Component\Form\Extension\Core\Type\PasswordType;
  9. use Symfony\Component\Form\Extension\Core\Type\SubmitType;
  10. use Symfony\Component\Form\Extension\Core\Type\TextType;
  11. use Symfony\Component\Form\FormBuilderInterface;
  12. use Symfony\Component\OptionsResolver\OptionsResolver;
  13. use Symfony\Component\Validator\Constraints\Email;
  14. /**
  15.  * Simple Login form for the home page.
  16.  */
  17. class LoginFormType extends AbstractType
  18. {
  19.     /**
  20.      * Form consturctor
  21.      *
  22.      * {@Inheritdoc}
  23.      */
  24.     public function buildForm(FormBuilderInterface $builder, array $options)
  25.     {
  26.         $builder
  27.             ->add('email_address'TextType::class, [
  28.                 'constraints' => [
  29.                     new Email(),
  30.                 ],
  31.                 'label' => 'Registered Email Address',
  32.             ])
  33.             ->add('password'PasswordType::class)
  34.             ->add('submit'SubmitType::class, [
  35.                 'label' => 'Login',
  36.             ]);
  37.     }
  38.     /**
  39.      * Form vlaidator
  40.      *
  41.      * {@Inheritdoc}
  42.      */
  43.     public function configureOptions(OptionsResolver $resolver)
  44.     {
  45.         $resolver->setDefaults([
  46.             // Configure your form options here
  47.         ]);
  48.     }
  49. }