You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

94 lines
3.4KB

  1. <?php
  2. namespace App\Form;
  3. use App\Entity\IndividualData\IndividualData;
  4. use App\Entity\Territory\Territory;
  5. use Lc\PietroBundle\Form\Revolt\RevoltType;
  6. use Lc\PietroBundle\Form\Dream\DreamType;
  7. use Lc\PietroBundle\Form\ProjectInspiring\ProjectInspiringType;
  8. use Lc\PietroBundle\Form\ProjectBoost\ProjectBoostType;
  9. use Symfony\Bridge\Doctrine\Form\Type\EntityType;
  10. use Symfony\Component\Form\AbstractType;
  11. use Symfony\Component\Form\Extension\Core\Type\CollectionType;
  12. use Symfony\Component\Form\Extension\Core\Type\SubmitType;
  13. use Symfony\Component\Form\FormBuilderInterface;
  14. use Symfony\Component\OptionsResolver\OptionsResolver;
  15. class IndividualDataForm extends AbstractType
  16. {
  17. public function buildForm(FormBuilderInterface $builder, array $options)
  18. {
  19. $builder
  20. ->add('territory', EntityType::class, [
  21. 'label' => 'form.field.territory.label',
  22. 'translation_domain' => 'frontend',
  23. 'class' => Territory::class,
  24. 'expanded' => true,
  25. 'multiple' => false,
  26. ])
  27. ->add('revolt', CollectionType::class, [
  28. 'label' => 'form.field.revolt.label',
  29. 'translation_domain' => 'frontend',
  30. 'entry_type' => RevoltType::class,
  31. 'entry_options' => [
  32. 'context' => $options['context'],
  33. 'label' => false,
  34. ],
  35. 'allow_add' => true,
  36. 'allow_delete' => true,
  37. 'by_reference' => false,
  38. ])
  39. ->add('dream', CollectionType::class, [
  40. 'label' => 'form.field.dream.label',
  41. 'translation_domain' => 'frontend',
  42. 'entry_type' => DreamType::class,
  43. 'entry_options' => [
  44. 'context' => $options['context'],
  45. 'label' => false,
  46. ],
  47. 'allow_add' => true,
  48. 'allow_delete' => true,
  49. 'by_reference' => false,
  50. ])
  51. ->add('projectBoost', CollectionType::class, [
  52. 'label' => 'form.field.projectBoost.label',
  53. 'translation_domain' => 'frontend',
  54. 'entry_type' => ProjectBoostType::class,
  55. 'entry_options' => [
  56. 'context' => $options['context'],
  57. 'label' => false,
  58. ],
  59. 'allow_add' => true,
  60. 'allow_delete' => true,
  61. 'by_reference' => false,
  62. ])
  63. ->add('projectInspiring', CollectionType::class, [
  64. 'label' => 'form.field.projectinspiring.label',
  65. 'translation_domain' => 'frontend',
  66. 'entry_type' => ProjectInspiringType::class,
  67. 'entry_options' => [
  68. 'context' => $options['context'],
  69. 'label' => false,
  70. ],
  71. 'allow_add' => true,
  72. 'allow_delete' => true,
  73. 'by_reference' => false,
  74. ])
  75. ->add('save', SubmitType::class, [
  76. 'attr' => ['class' => 'save button-yellow'],
  77. 'label' => 'ENVOYER'
  78. ]);
  79. }
  80. public function configureOptions(OptionsResolver $resolver)
  81. {
  82. $resolver->setDefaults(
  83. [
  84. 'data_class' => IndividualData::class,
  85. "context" => "backend"
  86. ]
  87. );
  88. }
  89. }