]> Raphaël G. Git Repositories - airbundle/commitdiff
Add RegisterType form with phone field extension
authorRaphaël Gertz <git@rapsys.eu>
Thu, 14 Nov 2019 22:59:52 +0000 (23:59 +0100)
committerRaphaël Gertz <git@rapsys.eu>
Thu, 14 Nov 2019 22:59:52 +0000 (23:59 +0100)
Form/RegisterType.php [new file with mode: 0644]

diff --git a/Form/RegisterType.php b/Form/RegisterType.php
new file mode 100644 (file)
index 0000000..f7cda54
--- /dev/null
@@ -0,0 +1,24 @@
+<?php
+
+namespace Rapsys\AirBundle\Form;
+
+use Symfony\Component\Form\Extension\Core\Type\TelType;
+use Symfony\Component\Form\FormBuilderInterface;
+use Symfony\Component\Validator\Constraints\NotBlank;
+
+class RegisterType extends \Rapsys\UserBundle\Form\RegisterType {
+       /**
+        * {@inheritdoc}
+        */
+       public function buildForm(FormBuilderInterface $builder, array $options) {
+               return parent::buildForm($builder, $options)
+                       ->add('phone', TelType::class, array('attr' => array('placeholder' => 'Your phone'), 'constraints' => array(new NotBlank(array('message' => 'Please provide your phone')))));
+       }
+
+       /**
+        * {@inheritdoc}
+        */
+       public function getName() {
+               return 'rapsys_air_register';
+       }
+}