Browse Source

Passage de l'activation user en switch

François Drouhard 2 years ago
parent
commit
5a9e01f7dc
2 changed files with 7 additions and 6 deletions
  1. 6 6
      src/Form/UserType.php
  2. 1 0
      translations/messages.fr.yaml

+ 6 - 6
src/Form/UserType.php

@@ -3,6 +3,7 @@
 namespace App\Form;
 
 use Symfony\Component\Form\AbstractType;
+use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
 use Symfony\Component\Form\Extension\Core\Type\RepeatedType;
 use Symfony\Component\Form\Extension\Core\Type\TextType;
 use Symfony\Component\Form\Extension\Core\Type\EmailType;
@@ -43,12 +44,11 @@ class UserType extends AbstractType
                 ),
                 'multiple'  => true
             ))
-            ->add('activated', ChoiceType::class, array(
-                'label' => 'Compte activé',
-                'choices'   => array(
-                    'Oui'   => true,
-                    'Non'   => false
-                )
+            ->add('activated', CheckboxType::class, array(
+                'label_attr' => [
+                    'class' =>  'checkbox-switch'
+                ],
+                'required'  => false
             ))
             ->add('save', SubmitType::class, array('label' => 'Enregistrer'));
 

+ 1 - 0
translations/messages.fr.yaml

@@ -30,5 +30,6 @@ User: Utilisateur
 Modérateur: Modérateur
 Super Admin: Super Admin
 Compte activé: Compte activé
+Activated: Compte activé
 Oui: Oui
 Non: Non