<?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
*/
namespace App\Form;
use Pimcore\Localization\LocaleService;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\EmailType;
use Symfony\Component\Form\Extension\Core\Type\NumberType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
use Symfony\Component\Form\Extension\Core\Type\PasswordType;
use Symfony\Component\Form\Extension\Core\Type\RepeatedType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Validator\Constraints as Assert;
class JoinFormType extends AbstractType
{
/**
* @var LocaleService
*/
/* protected $locale;
public function __construct(LocaleService $locale)
{
$this->locale = $locale;
} */
/**
* @inheritDoc
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
/* $regionArray = $this->locale->getDisplayRegions(); */
$builder
->add('email', EmailType::class, [
'required' => true,
'constraints' => [
new Assert\Email(['message' => 'Email not valid.']),
]
])
->add('firstname', TextType::class, [
'required' => true,
'constraints' => [
new Assert\NotBlank(['message' => 'Firstname cannot be blank.']),
]
])
->add('lastname', TextType::class, [
'required' => true,
'constraints' => [
new Assert\NotBlank(['message' => 'Surname cannot be blank.']),
]
])
->add('password', RepeatedType::class, [
'type' => PasswordType::class,
'invalid_message' => 'The password fields must match.',
'required' => true,
'constraints' => [
new Assert\Length([
'min' => 8,
'max' => 200,
'minMessage' => 'Your password must be at least 8 characters long',
'maxMessage' => 'Your password cannot be longer than 200 characters',
])],
'first_options' => ['label' => 'Password', 'error_bubbling' => true],
'second_options' => ['label' => 'Repeat Password'],
])->add('submit', SubmitType::class, [
'label' => 'Proceed to payment',
'attr' => [
'class' => 'oscare-primary-btn'
]
])->add('termsAndPrivacy', CheckboxType::class, [
'required' => true
])->add('consent', CheckboxType::class, [
'required' => false
]);
}
/**
* @inheritDoc
*/
public function getBlockPrefix()
{
// we need to set this to an empty string as we want _username as input name
// instead of login_form[_username] to work with the form authenticator out
// of the box
return '';
}
/**
* @inheritDoc
*/
public function configureOptions(OptionsResolver $resolver)
{
}
}