turbo #4
|
@ -5,34 +5,65 @@ namespace App\Form;
|
||||||
use App\Entity\User;
|
use App\Entity\User;
|
||||||
use Symfony\Component\Form\AbstractType;
|
use Symfony\Component\Form\AbstractType;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\EmailType;
|
use Symfony\Component\Form\Extension\Core\Type\EmailType;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\FileType;
|
|
||||||
use Symfony\Component\Form\Extension\Core\Type\PasswordType;
|
use Symfony\Component\Form\Extension\Core\Type\PasswordType;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\RepeatedType;
|
use Symfony\Component\Form\Extension\Core\Type\RepeatedType;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||||
use Symfony\Component\Validator\Constraints\Image;
|
|
||||||
use Symfony\Component\Validator\Constraints\Length;
|
use Symfony\Component\Validator\Constraints\Length;
|
||||||
|
use Symfony\UX\Cropperjs\Form\CropperType;
|
||||||
|
use Symfony\UX\Dropzone\Form\DropzoneType;
|
||||||
|
|
||||||
class EditProfileFormType extends AbstractType
|
class EditProfileFormType extends AbstractType
|
||||||
{
|
{
|
||||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||||
{
|
{
|
||||||
$builder
|
$builder
|
||||||
->add(child: 'username')
|
->add(child: 'username', options: [
|
||||||
->add(child: 'firstName')
|
'attr' => [
|
||||||
->add(child: 'lastName')
|
'autocomplete' => 'nickname'
|
||||||
->add(child: 'email', type: EmailType::class)
|
]
|
||||||
|
])
|
||||||
|
->add(child: 'firstName', options: [
|
||||||
|
'required' => false,
|
||||||
|
'attr' => [
|
||||||
|
'autocomplete' => 'given-name'
|
||||||
|
]
|
||||||
|
])
|
||||||
|
->add(child: 'lastName', options: [
|
||||||
|
'required' => false,
|
||||||
|
'attr' => [
|
||||||
|
'autocomplete' => 'family-name'
|
||||||
|
]
|
||||||
|
|
||||||
|
])
|
||||||
|
->add(child: 'email', type: EmailType::class, options: [
|
||||||
|
'attr' => [
|
||||||
|
'autocomplete' => 'email'
|
||||||
|
]
|
||||||
|
])
|
||||||
|
/*
|
||||||
|
->add(child: 'avatarName', type: DropzoneType::class, options: [
|
||||||
|
'mapped' => false,
|
||||||
|
'required' => false,
|
||||||
|
'attr' => [
|
||||||
|
'data-controller' => 'upload-avatar',
|
||||||
|
]
|
||||||
|
])
|
||||||
|
*/
|
||||||
->add(child: 'newPassword', type: RepeatedType::class, options: [
|
->add(child: 'newPassword', type: RepeatedType::class, options: [
|
||||||
'type' => PasswordType::class,
|
'type' => PasswordType::class,
|
||||||
'mapped' => false,
|
'mapped' => false,
|
||||||
'invalid_message' => 'The password fields must match.',
|
'invalid_message' => 'The password fields must match.',
|
||||||
'options' => ['attr' => ['class' => 'password-field', 'autocomplete' => 'off']],
|
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'first_options' => ['label' => 'Password'],
|
'first_options' => ['label' => 'Password'],
|
||||||
'second_options' => ['label' => 'Repeat Password (only needed if you want to update the password)'],
|
'second_options' => ['label' => 'Repeat Password (only needed if you want to update the password)'],
|
||||||
'constraints' => [new Length(exactly: ['min' => 6])]
|
'constraints' => [new Length(exactly: ['min' => 6])],
|
||||||
])
|
'options' => [
|
||||||
;
|
'attr' => [
|
||||||
|
'autocomplete' => 'new-password'
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function configureOptions(OptionsResolver $resolver): void
|
public function configureOptions(OptionsResolver $resolver): void
|
||||||
|
|
Loading…
Reference in New Issue