mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-29 11:03:50 +00:00
create contextmanager and refactor docgeneratorTemplateType
This commit is contained in:
@@ -11,6 +11,8 @@ declare(strict_types=1);
|
||||
|
||||
namespace Chill\DocGeneratorBundle\Form;
|
||||
|
||||
use Chill\DocGeneratorBundle\Context\ContextManager;
|
||||
use Chill\DocGeneratorBundle\Context\DocGeneratorContextInterface;
|
||||
use Chill\DocGeneratorBundle\Entity\DocGeneratorTemplate;
|
||||
use Chill\MainBundle\Form\Type\TranslatableStringFormType;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
@@ -19,17 +21,31 @@ use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
use Chill\DocStoreBundle\Form\StoredObjectType;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWorkEvaluation;
|
||||
use Chill\MainBundle\Form\Type\TranslatableStringFormType;
|
||||
|
||||
class DocGeneratorTemplateType extends AbstractType
|
||||
{
|
||||
private ContextManager $contextManager;
|
||||
|
||||
public function __construct(ContextManager $contextManager)
|
||||
{
|
||||
$this->contextManager = $contextManager;
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
$contexts = \array_flip(\array_map(function (DocGeneratorContextInterface $c) {
|
||||
return $c->getName();
|
||||
}, $this->contextManager->getContext()));
|
||||
|
||||
$builder
|
||||
->add('name', TranslatableStringFormType::class, [
|
||||
'label' => 'Nom',
|
||||
])
|
||||
->add('context')
|
||||
->add('context', ChoiceType::class, [
|
||||
'required' => true,
|
||||
'label' => 'Context',
|
||||
'choices' => $contexts
|
||||
])
|
||||
->add('entities', ChoiceType::class, [
|
||||
'multiple' => true,
|
||||
'choices' => [
|
||||
|
Reference in New Issue
Block a user