|
- <?php
-
- namespace Lc\PietroBundle\Definition\Field\Workshop;
-
- use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField;
- use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField;
- use EasyCorp\Bundle\EasyAdminBundle\Field\TextareaField;
- use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
- use Lc\PietroBundle\Repository\Workshop\WorkshopThematicStore;
- use Lc\SovBundle\Definition\Field\AbstractFieldDefinition;
- use Lc\SovBundle\Field\CKEditorField;
- use Lc\SovBundle\Translation\TranslatorAdmin;
-
- class WorkshopFieldDefinition extends AbstractFieldDefinition
- {
- protected WorkshopThematicStore $workshopThematicStore;
-
- public function __construct(TranslatorAdmin $translatorAdmin, WorkshopThematicStore $workshopThematicStore)
- {
- parent::__construct($translatorAdmin);
-
- $this->workshopThematicStore = $workshopThematicStore;
- }
-
- public function configureIndex(): array
- {
- return [
- 'workshopThematic',
- 'hook',
- 'title',
- 'entries',
- 'status'
- ];
- }
-
- public function configureForm(): array
- {
- return [
- 'workshopThematic',
- 'type',
- 'hook',
- 'title',
- 'description',
- 'status'
- ];
- }
-
- public function configureFields(): array
- {
- $workshopThematicArray = $this->workshopThematicStore->get();
-
- return [
- 'workshopThematic' => AssociationField::new('workshopThematic')
- ->setFormTypeOption('choices', $workshopThematicArray),
- 'type' => AssociationField::new('type'),
- 'title' => TextField::new('title'),
- 'hook' => TextField::new('hook'),
- 'description' => CKEditorField::new('description'),
- 'entries' => AssociationField::new('entries')
- ->setTemplatePath('@LcPietro/admin/workshop/field/entries.html.twig')
- ];
- }
- }
|