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.

WorkshopFieldDefinition.php 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. namespace Lc\PietroBundle\Definition\Field\Workshop;
  3. use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField;
  4. use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
  5. use Lc\PietroBundle\Repository\Workshop\WorkshopThematicStore;
  6. use Lc\SovBundle\Definition\Field\AbstractFieldDefinition;
  7. use Lc\SovBundle\Field\CKEditorField;
  8. use Lc\SovBundle\Translation\TranslatorAdmin;
  9. class WorkshopFieldDefinition extends AbstractFieldDefinition
  10. {
  11. protected WorkshopThematicStore $workshopThematicStore;
  12. public function __construct(TranslatorAdmin $translatorAdmin, WorkshopThematicStore $workshopThematicStore)
  13. {
  14. parent::__construct($translatorAdmin);
  15. $this->workshopThematicStore = $workshopThematicStore;
  16. }
  17. public function configureIndex(): array
  18. {
  19. return [
  20. 'workshopThematic',
  21. 'hook',
  22. 'title',
  23. 'entries',
  24. 'status'
  25. ];
  26. }
  27. public function configureForm(): array
  28. {
  29. return [
  30. 'workshopThematic',
  31. 'type',
  32. 'hook',
  33. 'title',
  34. 'description',
  35. 'emailContact',
  36. 'website',
  37. 'status'
  38. ];
  39. }
  40. public function configureFields(): array
  41. {
  42. $workshopThematicArray = $this->workshopThematicStore->get();
  43. return [
  44. 'workshopThematic' => AssociationField::new('workshopThematic')
  45. ->setFormTypeOption('choices', $workshopThematicArray),
  46. 'type' => AssociationField::new('type'),
  47. 'title' => TextField::new('title'),
  48. 'hook' => TextField::new('hook'),
  49. 'description' => CKEditorField::new('description'),
  50. 'emailContact' => TextField::new('emailContact'),
  51. 'website' => TextField::new('website'),
  52. 'entries' => AssociationField::new('entries')
  53. ->setTemplatePath('@LcPietro/admin/workshop/field/entries.html.twig')
  54. ];
  55. }
  56. }