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 1.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. namespace Lc\PietroBundle\Definition\Field\Workshop;
  3. use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField;
  4. use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField;
  5. use EasyCorp\Bundle\EasyAdminBundle\Field\TextareaField;
  6. use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
  7. use Lc\PietroBundle\Repository\Workshop\WorkshopThematicStore;
  8. use Lc\SovBundle\Definition\Field\AbstractFieldDefinition;
  9. use Lc\SovBundle\Field\CKEditorField;
  10. use Lc\SovBundle\Translation\TranslatorAdmin;
  11. class WorkshopFieldDefinition extends AbstractFieldDefinition
  12. {
  13. protected WorkshopThematicStore $workshopThematicStore;
  14. public function __construct(TranslatorAdmin $translatorAdmin, WorkshopThematicStore $workshopThematicStore)
  15. {
  16. parent::__construct($translatorAdmin);
  17. $this->workshopThematicStore = $workshopThematicStore;
  18. }
  19. public function configureIndex(): array
  20. {
  21. return [
  22. 'workshopThematic',
  23. 'hook',
  24. 'title',
  25. 'entries',
  26. 'status'
  27. ];
  28. }
  29. public function configureForm(): array
  30. {
  31. return [
  32. 'workshopThematic',
  33. 'type',
  34. 'hook',
  35. 'title',
  36. 'description',
  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. 'entries' => AssociationField::new('entries')
  51. ->setTemplatePath('@LcPietro/admin/workshop/field/entries.html.twig')
  52. ];
  53. }
  54. }