You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
2.1KB

  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\Controller\AdminControllerTrait;
  8. use Lc\CaracoleBundle\Model\Section\SectionModel;
  9. use Lc\SovBundle\Controller\AbstractAdminController;
  10. use Lc\SovBundle\Field\BooleanField;
  11. use Lc\SovBundle\Field\CKEditorField;
  12. use Lc\SovBundle\Field\StatusField;
  13. abstract class SectionAdminController extends AbstractAdminController
  14. {
  15. use AdminControllerTrait;
  16. public function configureFields(string $pageName): iterable
  17. {
  18. $panel = parent::configureFields($pageName);
  19. return array_merge(
  20. [
  21. FormField::addPanel('general'),
  22. TextField::new('title'),
  23. ChoiceField::new('cycle')
  24. ->setRequired(true)
  25. ->setChoices(
  26. [
  27. 'Jour' => SectionModel::CYCLE_DAY,
  28. 'Semaine' => SectionModel::CYCLE_WEEK,
  29. 'Mois' => SectionModel::CYCLE_MONTH,
  30. 'Année' => SectionModel::CYCLE_YEAR,
  31. ]
  32. ),
  33. TextField::new('color')
  34. ->setRequired(true)
  35. ->hideOnIndex(),
  36. NumberField::new('position')
  37. ->hideOnForm()
  38. ->hideOnIndex(),
  39. CKEditorField::new('description')
  40. ->hideOnIndex(),
  41. BooleanField::new('isDefault', 'Section par défaut'),
  42. StatusField::new('status'),
  43. ],
  44. $panel
  45. );
  46. }
  47. }