LettreSortedType.php 1.31 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
<?php

namespace PotageBundle\Form\Lettre;

use PotageBundle\Entity\Lettre;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

class LettreSortedType extends AbstractType
{
    /**
     * @param FormBuilderInterface $builder
     * @param array $options
     */
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
    
        $builder->add('sorted', HiddenType::class, array(
            'data' => array(),
        ));
        
        $builder->add('sauver', SubmitType::class, array(
            'label' => 'Sauvegarder',
            'attr' => array('class' => 'btn btn-dark mb-2')
        ));
    }
    
    /**
     * @param OptionsResolver $resolver
     */
    public function configureOptions(OptionsResolver $resolver)
    {
        parent::configureOptions($resolver);
        $resolver->setDefault('data_class', Lettre::class);
        $resolver->setDefault('attr', array(
            'class' => 'formulaire formulaire_lettre_sorted',
        ));
    }
    
    /**
     * @return null|string
     */
    public function getBlockPrefix()
    {
        return "lettre_sorted";
    }
}