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.

59 lines
1.8KB

  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. 'title',
  24. 'entries',
  25. ];
  26. }
  27. public function configureForm(): array
  28. {
  29. return [
  30. 'workshopThematic',
  31. 'type',
  32. 'title',
  33. 'description',
  34. //'entries'
  35. ];
  36. }
  37. public function configureFields(): array
  38. {
  39. $workshopThematicArray = $this->workshopThematicStore->get();
  40. return [
  41. 'workshopThematic' => AssociationField::new('workshopThematic')
  42. ->setFormTypeOption('choices', $workshopThematicArray),
  43. 'type' => AssociationField::new('type'),
  44. 'title' => TextField::new('title'),
  45. 'description' => TextareaField::new('description'),
  46. 'entries' => AssociationField::new('entries')
  47. ->setTemplatePath('@LcPietro/admin/workshop/field/entries.html.twig')
  48. ];
  49. }
  50. }