<?php
/**
* Pimcore
*
* This source file is available under two different licenses:
* - GNU General Public License version 3 (GPLv3)
* - Pimcore Enterprise License (PEL)
* Full copyright and license information is available in
* LICENSE.md which is distributed with this source code.
*
* @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org)
* @license http://www.pimcore.org/license GPLv3 and PEL
*/
declare(strict_types=1);
/**
* Pimcore
*
* This source file is available under two different licenses:
* - GNU General Public License version 3 (GPLv3)
* - Pimcore Enterprise License (PEL)
* Full copyright and license information is available in
* LICENSE.md which is distributed with this source code.
*
* @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org)
* @license http://www.pimcore.org/license GPLv3 and PEL
*/
namespace App\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\EmailType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\Extension\Core\Type\PasswordType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class RegistrationFormType extends AbstractType
{
/**
* @inheritDoc
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('email', EmailType::class, [
'label' => 'general.email',
'required' => true
])
->add('firstname', TextType::class, [
'label' => 'general.firstname',
'required' => true
])
->add('lastname', TextType::class, [
'label' => 'general.lastname',
'required' => true
]);
if (!$options['hidePassword']) {
$builder->add('password', PasswordType::class, [
'label' => 'general.password'
]);
}
$builder
->add('newsletter', CheckboxType::class, [
'label' => 'general.newsletter',
'required' => false,
'label_attr' => [
'class' => 'checkbox-custom'
]
])
->add('profiling', CheckboxType::class, [
'label' => 'general.profiling',
'required' => false,
'label_attr' => [
'class' => 'checkbox-custom'
]
]);
$builder
->add('oAuthKey', HiddenType::class)
->add('_submit', SubmitType::class, [
'label' => 'Register',
'attr' => [
'class' => 'btn btn-lg btn-block btn-success'
]
]);
}
/**
* @inheritDoc
*/
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefined('hidePassword');
}
}