src/Form/Inc/AgreeTermsType.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Form\Inc;
  3. use Symfony\Component\Form\AbstractType;
  4. use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
  5. use Symfony\Component\Form\FormBuilderInterface;
  6. use Symfony\Component\OptionsResolver\OptionsResolver;
  7. use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
  8. use Symfony\Component\Validator\Constraints\IsTrue;
  9. class AgreeTermsType extends AbstractType
  10. {
  11.     private $router;
  12.     public function __construct(UrlGeneratorInterface $ro){
  13.         $this->router $ro;
  14.     }
  15.     public function buildForm(FormBuilderInterface $builder, array $options)
  16.     {
  17.         $builder
  18.             /**->add('agreeTerms', CheckboxType::class, [
  19.                 'mapped'                => false,
  20.                 'label'                 => ' He leído y acepto el <a target="_blank" href="' . $this->router->generate('pag_cms_aviso_legal') . '" rel="nofollow" title="Aviso legal">Aviso legal</a>, la 
  21.                     <a href="' . $this->router->generate('pag_cms_politica_de_privacidad') . '" target="_blank" rel="nofollow" title="Política de privacidad">Política de privacidad</a> 
  22.                     y la <a href="' . $this->router->generate('pag_cms_politica_de_cookies') . '" target="_blank" rel="nofollow" title="Política de cookiesl">Política de cookies</a> de Insertia.net',
  23.                 'translation_domain'    => false,
  24.                 'label_attr'            => [
  25.                     'class'     => 'checkbox-custom checkbox-inline'
  26.                 ],
  27.                 'constraints'           => [
  28.                     new IsTrue([
  29.                         'message' => 'You should agree to our terms.',
  30.                     ]),
  31.                 ],
  32.             ])*/
  33.             ->add('agreeTerms'CheckboxType::class, [
  34.                 'mapped'                => false,
  35.                 'label'                 => 'security.register.form.agreeterms.label',
  36.                 'label_html'            => true,
  37.                 'translation_domain'    => 'security',
  38.                 'label_attr'            => [
  39.                     'class'     => 'checkbox-custom checkbox-inline'
  40.                 ],
  41.                 'constraints'           => [
  42.                     new IsTrue([
  43.                         'message' => 'You should agree to our terms.',
  44.                     ]),
  45.                 ],
  46.             ])
  47.         ;
  48.     }
  49.     public function configureOptions(OptionsResolver $resolver)
  50.     {
  51.         $resolver->setDefaults([
  52.             
  53.         ]);
  54.     }
  55. }