58 lines
1.5 KiB
PHP
58 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace App\Form;
|
|
|
|
use App\Core\Form\FileManager\FilePickerType;
|
|
use Symfony\Component\Form\AbstractType;
|
|
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
|
|
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
|
use Symfony\Component\Form\FormBuilderInterface;
|
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
|
use Symfony\Component\Validator\Constraints\NotBlank;
|
|
|
|
class FileType extends AbstractType
|
|
{
|
|
public function buildForm(FormBuilderInterface $builder, array $options)
|
|
{
|
|
$builder->add('position', HiddenType::class);
|
|
|
|
$builder->add(
|
|
'name',
|
|
TextType::class,
|
|
[
|
|
'label' => 'Nom',
|
|
'required' => true,
|
|
'attr' => [
|
|
],
|
|
'attr' => [
|
|
'class' => 'col-md-8',
|
|
],
|
|
'constraints' => [
|
|
new NotBlank(),
|
|
],
|
|
]
|
|
);
|
|
|
|
$builder->add(
|
|
'file',
|
|
FilePickerType::class,
|
|
[
|
|
'label' => 'Fichier',
|
|
'required' => true,
|
|
'attr' => [
|
|
'class' => 'col-md-6',
|
|
],
|
|
'constraints' => [
|
|
],
|
|
]
|
|
);
|
|
}
|
|
|
|
public function configureOptions(OptionsResolver $resolver)
|
|
{
|
|
$resolver->setDefaults([
|
|
// Configure your form options here
|
|
]);
|
|
}
|
|
}
|