您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

61 行
1.8KB

  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. 'status'
  36. ];
  37. }
  38. public function configureFields(): array
  39. {
  40. $workshopThematicArray = $this->workshopThematicStore->get();
  41. return [
  42. 'workshopThematic' => AssociationField::new('workshopThematic')
  43. ->setFormTypeOption('choices', $workshopThematicArray),
  44. 'type' => AssociationField::new('type'),
  45. 'title' => TextField::new('title'),
  46. 'hook' => TextField::new('hook'),
  47. 'description' => CKEditorField::new('description'),
  48. 'entries' => AssociationField::new('entries')
  49. ->setTemplatePath('@LcPietro/admin/workshop/field/entries.html.twig')
  50. ];
  51. }
  52. }