Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

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