Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

55 lines
1.5KB

  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\WorkshopStore;
  6. use Lc\SovBundle\Definition\Field\AbstractFieldDefinition;
  7. use Lc\SovBundle\Field\CKEditorField;
  8. use Lc\SovBundle\Translation\TranslatorAdmin;
  9. class SolutionFieldDefinition extends AbstractFieldDefinition
  10. {
  11. protected WorkshopStore $workshopStore;
  12. public function __construct(TranslatorAdmin $translatorAdmin, WorkshopStore $workshopStore)
  13. {
  14. parent::__construct($translatorAdmin);
  15. $this->workshopStore = $workshopStore;
  16. }
  17. public function configureIndex(): array
  18. {
  19. return [
  20. 'workshop',
  21. 'title',
  22. 'status'
  23. ];
  24. }
  25. public function configureForm(): array
  26. {
  27. return [
  28. 'workshop',
  29. 'title',
  30. 'description',
  31. 'videoLink',
  32. 'status'
  33. ];
  34. }
  35. public function configureFields(): array
  36. {
  37. $workshopArray = $this->workshopStore->get();
  38. return [
  39. 'workshop' => AssociationField::new('workshop')
  40. ->setFormTypeOption('choices', $workshopArray),
  41. 'title' => TextField::new('title'),
  42. 'description' => CKEditorField::new('description'),
  43. 'videoLink' => TextField::new('videoLink'),
  44. ];
  45. }
  46. }