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.

NewsAdminController.php 1.6KB

pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. use Lc\SovBundle\Repository\RepositoryQueryInterface;
  13. abstract class NewsAdminController extends AbstractAdminController
  14. {
  15. public function getRepositoryQuery() :RepositoryQueryInterface
  16. {
  17. return $this->get(NewsContainer::class)->getRepositoryQuery();
  18. }
  19. public function configureFields(string $pageName): iterable
  20. {
  21. $panel = parent::configureFields($pageName);
  22. return array_merge(
  23. [
  24. FormField::addPanel('general'),
  25. TextField::new('title'),
  26. DateField::new('date')
  27. ->setFormat('d/MM/y'),
  28. NumberField::new('position')
  29. ->hideOnIndex()
  30. ->hideOnForm(),
  31. CKEditorField::new('description'),
  32. StatusField::new('status'),
  33. ],
  34. $panel
  35. );
  36. }
  37. public function createEntity(string $entityFqcn)
  38. {
  39. return $this->get(NewsContainer::class)->getFactory()->create();
  40. }
  41. }