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

62 行
1.9KB

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