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.

NewsAdminController.php 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. namespace Lc\SovBundle\Controller\Site;
  3. use EasyCorp\Bundle\EasyAdminBundle\Field\DateField;
  4. use EasyCorp\Bundle\EasyAdminBundle\Field\FormField;
  5. use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField;
  6. use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
  7. use Lc\SovBundle\Container\Site\NewsContainer;
  8. use Lc\SovBundle\Controller\AbstractAdminController;
  9. use Lc\SovBundle\Factory\Site\NewsFactory;
  10. use Lc\SovBundle\Field\CKEditorField;
  11. use Lc\SovBundle\Field\StatusField;
  12. abstract class NewsAdminController extends AbstractAdminController
  13. {
  14. public function configureFields(string $pageName): iterable
  15. {
  16. $panel = parent::configureFields($pageName);
  17. return array_merge(
  18. [
  19. FormField::addPanel('general'),
  20. TextField::new('title'),
  21. DateField::new('date')
  22. ->setFormat('d/MM/y'),
  23. NumberField::new('position')
  24. ->hideOnIndex()
  25. ->hideOnForm(),
  26. CKEditorField::new('description'),
  27. StatusField::new('status'),
  28. ],
  29. $panel
  30. );
  31. }
  32. public function createEntity(string $entityFqcn)
  33. {
  34. return $this->get(NewsContainer::class)->getFactory()->create();
  35. }
  36. }