1 <?php
declare(strict_types
=1);
4 * This file is part of the Rapsys AirBundle 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\BlogBundle\Form
;
14 use Symfony\Bridge\Doctrine\Form\Type\EntityType
;
15 use Symfony\Component\Form\Extension\Core\Type\TelType
;
16 use Symfony\Component\Form\Extension\Core\Type\TextType
;
17 use Symfony\Component\Form\FormBuilderInterface
;
18 use Symfony\Component\OptionsResolver\OptionsResolver
;
20 use Rapsys\AirBundle\Entity\Country
;
22 use Rapsys\UserBundle\Form\RegisterType
as BaseRegisterType
;
24 class RegisterType
extends BaseRegisterType
{
28 public function buildForm(FormBuilderInterface
$builder, array $options): FormBuilderInterface
{
29 //Call parent build form
30 $form = parent
::buildForm($builder, $options);
32 //Add extra pseudonym field
33 if (!empty($options['pseudonym'])) {
34 $form->add('pseudonym', TextType
::class, ['attr' => ['placeholder' => 'Your pseudonym'], 'required' => false]);
37 //Add extra slug field
38 if (!empty($options['slug'])) {
39 $form->add('slug', TextType
::class, ['attr' => ['placeholder' => 'Your slug'], 'required' => false]);
49 public function configureOptions(OptionsResolver
$resolver): void {
50 //Call parent configure options
51 parent
::configureOptions($resolver);
54 $resolver->setDefaults(['pseudonym' => true, 'slug' => false]);
56 //Add extra pseudonym option
57 $resolver->setAllowedTypes('pseudonym', 'boolean');
59 //Add extra slug option
60 $resolver->setAllowedTypes('slug', 'boolean');
66 public function getName(): string {
67 return 'rapsys_blog_register';