1 <?php
declare(strict_types
=1);
4 * This file is part of the Rapsys PackBundle package.
6 * (c) Raphaël Gertz <symfony@rapsys.eu>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Rapsys\AirBundle\Form
;
14 use Symfony\Component\Form\Extension\Core\Type\TelType
;
15 use Symfony\Component\Form\Extension\Core\Type\UrlType
;
16 use Symfony\Component\Form\FormBuilderInterface
;
17 use Symfony\Component\OptionsResolver\OptionsResolver
;
18 use Symfony\Component\Validator\Constraints\NotBlank
;
20 class RegisterType
extends \Rapsys\UserBundle\Form\RegisterType
{
24 public function buildForm(FormBuilderInterface
$builder, array $options): FormBuilderInterface
{
25 //Call parent build form
26 $form = parent
::buildForm($builder, $options);
28 //Add extra phone field
29 if (!empty($options['phone'])) {
30 $form->add('phone', TelType
::class, ['attr' => ['placeholder' => 'Your phone'], 'required' => false]);
40 public function configureOptions(OptionsResolver
$resolver): void {
41 //Call parent configure options
42 parent
::configureOptions($resolver);
45 $resolver->setDefaults(['phone' => true]);
47 //Add extra mail option
48 $resolver->setAllowedTypes('phone', 'boolean');
55 public function getName(): string {
56 return 'rapsys_air_register';