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.

47 satır
1.4KB

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