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.

57 lines
2.2KB

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