No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

SectionAdminController.php 2.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. }