GroupeType.php 2.09 KB
Newer Older
1
2
3
4
<?php

namespace PotageBundle\Form\Groupe;

Mat's avatar
Mat committed
5
use PotageBundle\Entity\Depot;
6
use PotageBundle\Entity\Groupe;
Mat's avatar
Mat committed
7
8
use PotageBundle\Entity\Lettre;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
9
10
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\AbstractType;
Mat's avatar
Mat committed
11
12
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
13
14
15
16
17
18
19
20
21
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;


class GroupeType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        
Mat's avatar
Mat committed
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
        $builder->add('depot', EntityType::class, array(
            'class' => Depot::class,
            'choice_label' => 'getNom',
            'placeholder' => 'Associer le groupe à un point de dépôt',
            'label' => 'Point de dépôt',
            'attr' => array('class' => 'form-control form-control-sm'),
        ));
        $builder->add('nom', TextType::class, array(
            'label' => "Nom",
            'label_attr' => array('class' => 'col-form-label'),
            'attr' => array(
                'class' => 'form-control form-control-sm',
            ),
        ));
        $builder->add('description', TextareaType::class, array(
            'label' => "Description",
            'label_attr' => array('class' => 'col-form-label'),
            'attr' => array(
                'class' => 'form-control form-control-sm',
            ),
        ));

44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
        /* TODO les champs en plus
        */
        
        $builder->add('sauver', SubmitType::class, array(
            'label' => 'Enregistrer',
            'attr' => array('class' => 'btn btn-dark mb-2')
        ));
        
    }
    
    public function configureOptions(OptionsResolver $resolver)
    {
        parent::configureOptions($resolver);
        $resolver->setDefault('data_class', Groupe::class);
        $resolver->setDefault('attr', array(
            'class' => 'formulaire formulaire_groupe',
        ));
    }
    
    public function getBlockPrefix()
    {
        return 'groupe';
    }
}