Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

43 rindas
1.3KB

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