src/Form/RegisterType.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Form;
  3. use App\Entity\User;
  4. use Symfony\Component\Form\AbstractType;
  5. use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
  6. use Symfony\Component\Form\Extension\Core\Type\DateType;
  7. use Symfony\Component\Form\Extension\Core\Type\IntegerType;
  8. use Symfony\Component\Form\Extension\Core\Type\PasswordType;
  9. use Symfony\Component\Form\Extension\Core\Type\TextType;
  10. use Symfony\Component\Form\FormBuilderInterface;
  11. use Symfony\Component\OptionsResolver\OptionsResolver;
  12. class RegisterType extends AbstractType
  13. {
  14. public function buildForm(FormBuilderInterface $builder, array $options): void
  15. {
  16. $builder
  17. ->add('email', TextType::class, [
  18. 'label' => false,
  19. 'attr' => [
  20. 'placeholder' => "enter email",
  21. 'class' => 'input'
  22. ]
  23. ])
  24. ->add('password', PasswordType::class, [
  25. 'label' => false,
  26. 'attr' => [
  27. 'class' => 'input'
  28. ]
  29. ])
  30. ->add('name', TextType::class, [
  31. 'label' => false,
  32. 'attr' => [
  33. 'class' => 'input'
  34. ]
  35. ])
  36. ->add('birthday', DateType::class, [
  37. 'label' => false,
  38. 'widget' => 'single_text',
  39. 'attr' => [
  40. 'type' => 'date',
  41. ]
  42. ])
  43. ->add('phone', IntegerType::class, [
  44. 'label' => false,
  45. 'attr' => [
  46. 'class' => 'input',
  47. ]
  48. ])
  49. ->add('state', TextType::class, [
  50. 'label' => false,
  51. 'attr' => [
  52. 'class' => 'input',
  53. ]
  54. ])
  55. ->add('country', TextType::class, [
  56. 'label' => false,
  57. 'attr' => [
  58. 'class' => 'input',
  59. ]
  60. ])
  61. ->add('postalCode', TextType::class, [
  62. 'label' => false,
  63. 'attr' => [
  64. 'class' => 'input',
  65. ]
  66. ])
  67. ->add('gender', ChoiceType::class, [
  68. 'choices' => [
  69. 'ذكر' => 'male',
  70. 'أنثى' => 'female',
  71. ],
  72. 'label' => false,
  73. 'attr' => [
  74. 'class' => 'input'
  75. ]
  76. ])
  77. ->add('address', TextType::class, [
  78. 'label' => false,
  79. 'attr' => [
  80. 'class' => 'input'
  81. ]
  82. ]);
  83. ;
  84. }
  85. public function configureOptions(OptionsResolver $resolver): void
  86. {
  87. $resolver->setDefaults([
  88. 'data_class' => User::class,
  89. ]);
  90. }
  91. }