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.

NewsletterAdminController.php 1.5KB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
12345678910111213141516171819202122232425262728293031323334353637383940414243
  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\Container\Newsletter\NewsletterContainer;
  6. use Lc\SovBundle\Controller\AbstractAdminController;
  7. use Lc\SovBundle\Factory\Newsletter\NewsletterFactory;
  8. use Lc\SovBundle\Field\BooleanField;
  9. use Lc\SovBundle\Field\CKEditorField;
  10. use Lc\SovBundle\Field\StatusField;
  11. use Lc\SovBundle\Repository\RepositoryQueryInterface;
  12. abstract class NewsletterAdminController extends AbstractAdminController
  13. {
  14. public function getRepositoryQuery() :RepositoryQueryInterface
  15. {
  16. return $this->get(NewsletterContainer::class)->getRepositoryQuery();
  17. }
  18. public function configureFields(string $pageName): iterable
  19. {
  20. return array_merge(
  21. [
  22. FormField::addPanel('general'),
  23. TextField::new('title'),
  24. BooleanField::new('isMain')
  25. ->setCustomOption('toggle_label', 'Principale'),
  26. CKEditorField::new('description')
  27. ->hideOnIndex(),
  28. StatusField::new('status'),
  29. ],
  30. $this->getSeoPanel(),
  31. $this->getConfPanel()
  32. );
  33. }
  34. public function createEntity(string $entityFqcn)
  35. {
  36. return $this->get(NewsletterContainer::class)->getFactory()->create();
  37. }
  38. }