You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
1.2 KiB
PHP
45 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Form\Config;
|
|
|
|
use App\Entity\Material;
|
|
use Symfony\Component\Form\AbstractType;
|
|
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
|
use Symfony\Component\Form\FormBuilderInterface;
|
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
|
|
|
/**
|
|
* The form for editing a material
|
|
*/
|
|
class MaterialEditForm extends AbstractType {
|
|
/**
|
|
* @inheritDoc
|
|
*/
|
|
public function configureOptions (OptionsResolver $resolver): void {
|
|
$resolver->setDefaults(
|
|
[
|
|
'data_class' => Material::class,
|
|
]
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @inheritDoc
|
|
*/
|
|
public function buildForm (FormBuilderInterface $builder, array $options): void {
|
|
$builder
|
|
->add('name', null, [
|
|
'label' => 'Nom',
|
|
])
|
|
->add('type', null, [
|
|
'label' => 'Type',
|
|
])
|
|
->add('isCraftableByDefault', null, [
|
|
'label' => 'Est-ce que ce matériel est craftable par défaut ?',
|
|
'required' => false,
|
|
])
|
|
->add('submit', SubmitType::class, [
|
|
'label' => 'Enregistrer',
|
|
]);
|
|
}
|
|
} |