Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

43 linhas
1.4KB

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