39 行
1.2KB

  1. <?php
  2. namespace Lc\SovBundle\Controller\Newsletter;
  3. use EasyCorp\Bundle\EasyAdminBundle\Field\FormField;
  4. use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
  5. use Lc\SovBundle\Controller\AbstractAdminController;
  6. use Lc\SovBundle\Factory\Newsletter\NewsletterFactory;
  7. use Lc\SovBundle\Field\BooleanField;
  8. use Lc\SovBundle\Field\CKEditorField;
  9. use Lc\SovBundle\Field\StatusField;
  10. abstract class NewsletterAdminController extends AbstractAdminController
  11. {
  12. public function configureFields(string $pageName): iterable
  13. {
  14. return array_merge(
  15. [
  16. FormField::addPanel('general'),
  17. TextField::new('title'),
  18. BooleanField::new('isMain')
  19. ->setCustomOption('toggle_label', 'Principale'),
  20. CKEditorField::new('description')
  21. ->hideOnIndex(),
  22. StatusField::new('status'),
  23. ],
  24. $this->getSeoPanel(),
  25. $this->getConfPanel()
  26. );
  27. }
  28. public function createEntity(string $entityFqcn)
  29. {
  30. $factory = new NewsletterFactory();
  31. return $factory->create();
  32. }
  33. }