|
- <?php
-
- namespace Lc\PietroBundle\Definition\Field\Workshop;
-
- use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField;
- use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
- use Lc\PietroBundle\Repository\Workshop\WorkshopStore;
- use Lc\SovBundle\Definition\Field\AbstractFieldDefinition;
- use Lc\SovBundle\Field\CKEditorField;
- use Lc\SovBundle\Translation\TranslatorAdmin;
-
- class SolutionFieldDefinition extends AbstractFieldDefinition
- {
- protected WorkshopStore $workshopStore;
-
- public function __construct(TranslatorAdmin $translatorAdmin, WorkshopStore $workshopStore)
- {
- parent::__construct($translatorAdmin);
-
- $this->workshopStore = $workshopStore;
- }
-
- public function configureIndex(): array
- {
- return [
- 'workshop',
- 'title',
- 'status'
- ];
- }
-
- public function configureForm(): array
- {
- return [
- 'workshop',
- 'title',
- 'description',
- 'videoLink',
- 'status'
- ];
- }
-
- public function configureFields(): array
- {
- $workshopArray = $this->workshopStore->get();
-
- return [
- 'workshop' => AssociationField::new('workshop')
- ->setFormTypeOption('choices', $workshopArray),
- 'title' => TextField::new('title'),
- 'description' => CKEditorField::new('description'),
- 'videoLink' => TextField::new('videoLink'),
- ];
- }
- }
|