59 lines
1.7 KiB
PHP
59 lines
1.7 KiB
PHP
<?php
|
|
namespace App\Form;
|
|
|
|
use Symfony\Component\Form\AbstractType;
|
|
use Symfony\Component\Form\FormBuilderInterface;
|
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
|
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
|
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
|
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
|
use Tetranz\Select2EntityBundle\Form\Type\Select2EntityType;
|
|
|
|
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
|
|
|
|
|
use Doctrine\ORM\EntityRepository;
|
|
use Doctrine\ORM\EntityManager;
|
|
|
|
class ScrumcolumnType extends AbstractType
|
|
{
|
|
public function buildForm(FormBuilderInterface $builder, array $options)
|
|
{
|
|
$builder->add('submit',
|
|
SubmitType::class, [
|
|
"label" => "Valider",
|
|
"attr" => ["class" => "btn btn-success no-print"],
|
|
]
|
|
);
|
|
|
|
$builder->add('name',
|
|
TextType::class, [
|
|
"label" =>"Nom",
|
|
]
|
|
);
|
|
|
|
$choices=[];
|
|
foreach($options["gitealabels"] as $label) {
|
|
$choices[$label->name]=$label->id;
|
|
}
|
|
|
|
$builder->add('giteaid',
|
|
ChoiceType::class, [
|
|
"label" => "Label Gitea",
|
|
"choices" => $choices,
|
|
"disabled" => ($options["mode"]=="submit"?false:true),
|
|
"placeholder" => "Selectionnez un label gitea",
|
|
]
|
|
);
|
|
}
|
|
|
|
public function configureOptions(OptionsResolver $resolver)
|
|
{
|
|
$resolver->setDefaults(array(
|
|
'data_class' => 'App\Entity\Scrumcolumn',
|
|
'mode' => 'string',
|
|
'gitealabels' => 'string',
|
|
));
|
|
}
|
|
}
|