|
- <?php
-
- namespace Lc\SovBundle\Form\User;
-
-
- use Lc\SovBundle\Doctrine\EntityManager;
- use Lc\SovBundle\Translation\TranslatorAdmin;
- use Symfony\Component\Form\AbstractType;
- use Symfony\Component\Form\Extension\Core\Type\ButtonType;
- use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
- use Symfony\Component\Form\Extension\Core\Type\SubmitType;
- use Symfony\Component\Form\FormBuilderInterface;
- use Symfony\Component\OptionsResolver\OptionsResolver;
-
- class ConfirmDeleteUserFormType extends AbstractType
- {
-
- protected $em;
- protected $translatorAdmin;
-
- public function __construct(EntityManager $em, TranslatorAdmin $translatorAdmin)
- {
- $this->em = $em;
- $this->translatorAdmin = $translatorAdmin;
- }
-
- /**
- * {@inheritdoc}
- */
- public function buildForm(FormBuilderInterface $builder, array $options)
- {
-
- $builder->add(
- 'confirmDelete',
- CheckboxType::class,
- [
- 'translation_domain' => 'admin',
- ]
- );
-
- $builder->add(
- 'delete',
- SubmitType::class,
- array(
- 'label'=> 'action.delete'
- )
-
- );
- }
- public function configureOptions(OptionsResolver $resolver): void
- {
- $resolver->setDefaults([
- // enable/disable CSRF protection for this form
- 'csrf_protection' => true,
- // the name of the hidden HTML field that stores the token
- 'csrf_field_name' => '_token',
- // an arbitrary string used to generate the value of the token
- // using a different string for each form improves its security
- 'csrf_token_id' => 'ea-delete',
- 'translation_domain'=> 'admin'
- ]);
- }
-
-
- }
|