deblan.io-murph/src/Form/StlFileType.php

72 lines
1.8 KiB
PHP
Raw Normal View History

2021-10-20 14:17:13 +02:00
<?php
namespace App\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use App\Core\Form\FileManager\FilePickerType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Form\Extension\Core\Type\TextType;
class StlFileType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('position', HiddenType::class);
$builder->add(
'name',
TextType::class,
[
'label' => 'Nom',
'required' => true,
'attr' => [
],
2021-11-13 23:32:25 +01:00
'row_attr' => [
'class' => 'col-md-6',
],
2021-10-20 14:17:13 +02:00
'constraints' => [
new NotBlank(),
],
]
);
$builder->add(
'file',
FilePickerType::class,
[
2021-11-13 23:32:25 +01:00
'label' => 'Fichier STL',
2021-10-20 14:17:13 +02:00
'required' => true,
2021-11-13 23:32:25 +01:00
'row_attr' => [
'class' => 'col-md-6',
],
'constraints' => [
],
]
);
$builder->add(
'htmlPreviewFile',
FilePickerType::class,
[
'label' => 'Rendu HTML',
'required' => false,
'row_attr' => [
'class' => 'col-md-6',
],
2021-10-20 14:17:13 +02:00
'constraints' => [
],
]
);
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
// Configure your form options here
]);
}
}