|
- <?php
-
- namespace Lc\CaracoleBundle\Controller\Section;
-
- use EasyCorp\Bundle\EasyAdminBundle\Field\ChoiceField;
- use EasyCorp\Bundle\EasyAdminBundle\Field\FormField;
- use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField;
- use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
- use Lc\CaracoleBundle\Container\Section\SectionContainer;
- use Lc\CaracoleBundle\Controller\AdminControllerTrait;
- use Lc\CaracoleBundle\Factory\Section\SectionFactory;
- use Lc\CaracoleBundle\Form\Section\OpeningsFormType;
- use Lc\CaracoleBundle\Model\Section\SectionModel;
- use Lc\CaracoleBundle\Resolver\MerchantResolver;
- use Lc\SovBundle\Controller\AbstractAdminController;
- use Lc\SovBundle\Field\BooleanField;
- use Lc\SovBundle\Field\CKEditorField;
- use Lc\SovBundle\Field\StatusField;
- use Symfony\Component\HttpFoundation\Request;
- use Symfony\Component\HttpFoundation\Session\SessionFactory;
- use Symfony\Component\Routing\Annotation\Route;
-
- abstract class SectionAdminController extends AbstractAdminController
- {
- use AdminControllerTrait;
-
- public function configureFields(string $pageName): iterable
- {
- return array_merge(
- [
- FormField::addPanel('general'),
- TextField::new('title'),
- ChoiceField::new('cycleType')
- ->setRequired(true)
- ->hideOnIndex()
- ->setChoices(
- [
- 'Jour' => SectionModel::CYCLE_TYPE_DAY,
- 'Semaine' => SectionModel::CYCLE_TYPE_WEEK,
- 'Mois' => SectionModel::CYCLE_TYPE_MONTH,
- 'Année' => SectionModel::CYCLE_TYPE_YEAR,
- ]
- ),
- TextField::new('color')
- ->setRequired(true),
- NumberField::new('position')
- ->hideOnForm()
- ->hideOnIndex(),
- CKEditorField::new('description')
- ->hideOnIndex(),
- BooleanField::new('isDefault'),
- StatusField::new('status'),
- ],
- $this->getSeoPanel(),
- $this->getConfPanel(),
- );
- }
-
- public function createEntity(string $entityFqcn)
- {
- return $this->get(SectionContainer::class)
- ->getFactory()
- ->create($this->get(MerchantResolver::class)->getCurrent());
- }
-
- }
|