src/ClientBundle/Form/RegisterType.php line 14

Open in your IDE?
  1. <?php
  2. namespace ClientBundle\Form;
  3. use AdminBundle\Entity\User;
  4. use Symfony\Component\Form\AbstractType;
  5. use Symfony\Component\Form\FormBuilderInterface;
  6. use Symfony\Component\Form\Extension\Core\Type\EmailType;
  7. use Symfony\Component\Form\Extension\Core\Type\PasswordType;
  8. use Symfony\Component\Form\Extension\Core\Type\RepeatedType;
  9. use Symfony\Component\Form\Extension\Core\Type\TextType;
  10. use Symfony\Component\OptionsResolver\OptionsResolver;
  11. class RegisterType extends AbstractType {
  12. /**
  13. * {@inheritdoc}
  14. */
  15. public function buildForm(
  16. FormBuilderInterface $builder,
  17. array $options) {
  18. $builder
  19. ->add('email', EmailType::class,[
  20. 'label' => 'Email Address',
  21. 'attr' => [
  22. 'class' => 'form-control'
  23. ]
  24. ])
  25. ->add('firstname', null, [
  26. 'label' => 'First Name',
  27. 'attr' => [
  28. 'class' => 'form-control'
  29. ]
  30. ])
  31. ->add('lastname', null, [
  32. 'label' => 'Last Name',
  33. 'attr' => [
  34. 'class' => 'form-control'
  35. ]
  36. ])
  37. ->add('plainPassword', RepeatedType::class, [
  38. 'type' => PasswordType::class,
  39. 'options' => [
  40. 'attr' => [
  41. 'class' => 'form-control'
  42. ]
  43. ],
  44. 'first_options' => [
  45. 'label' => 'Password'
  46. ],
  47. 'second_options' => [
  48. 'label' => 'Repeat password'
  49. ],
  50. 'invalid_message' => 'The passwords did not match.',
  51. ])
  52. ;
  53. }
  54. /**
  55. * {@inheritdoc}
  56. */
  57. public function configureOptions(
  58. OptionsResolver $resolver
  59. ) {
  60. $resolver->setDefaults(array(
  61. 'data_class' => User::class,
  62. 'csrf_token_id' => 'client_register',
  63. ));
  64. }
  65. /**
  66. * {@inheritdoc}
  67. */
  68. public function getBlockPrefix() {
  69. return 'client_register';
  70. }
  71. }