Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

65 rindas
2.5KB

  1. <?php
  2. namespace Lc\CaracoleBundle\Controller\Section;
  3. use EasyCorp\Bundle\EasyAdminBundle\Field\ChoiceField;
  4. use EasyCorp\Bundle\EasyAdminBundle\Field\FormField;
  5. use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField;
  6. use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
  7. use Lc\CaracoleBundle\Container\Section\SectionContainer;
  8. use Lc\CaracoleBundle\Controller\AbstractAdminController;
  9. use Lc\CaracoleBundle\Model\Section\SectionModel;
  10. use Lc\CaracoleBundle\Resolver\MerchantResolver;
  11. use Lc\SovBundle\Field\BooleanField;
  12. use Lc\SovBundle\Field\CKEditorField;
  13. use Lc\SovBundle\Field\StatusField;
  14. use Lc\SovBundle\Repository\RepositoryQueryInterface;
  15. abstract class SectionAdminController extends AbstractAdminController
  16. {
  17. public function getRepositoryQuery() :RepositoryQueryInterface
  18. {
  19. return $this->get(SectionContainer::class)->getRepositoryQuery();
  20. }
  21. public function createEntity(string $entityFqcn)
  22. {
  23. return $this->getSectionContainer()
  24. ->getFactory()
  25. ->create($this->getMerchantCurrent());
  26. }
  27. public function configureFields(string $pageName): iterable
  28. {
  29. return array_merge(
  30. [
  31. FormField::addPanel('general'),
  32. TextField::new('title'),
  33. ChoiceField::new('cycleType')
  34. ->setRequired(true)
  35. ->hideOnIndex()
  36. ->setChoices(
  37. [
  38. 'Jour' => SectionModel::CYCLE_TYPE_DAY,
  39. 'Semaine' => SectionModel::CYCLE_TYPE_WEEK,
  40. 'Mois' => SectionModel::CYCLE_TYPE_MONTH,
  41. 'Année' => SectionModel::CYCLE_TYPE_YEAR,
  42. ]
  43. ),
  44. TextField::new('color')
  45. ->setRequired(true),
  46. NumberField::new('position')
  47. ->hideOnForm()
  48. ->hideOnIndex(),
  49. CKEditorField::new('description')
  50. ->hideOnIndex(),
  51. BooleanField::new('isDefault'),
  52. StatusField::new('status'),
  53. ],
  54. $this->getSeoPanel(),
  55. $this->getConfPanel(),
  56. );
  57. }
  58. }