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.

59 line
1.7KB

  1. <?php
  2. namespace Lc\SovBundle\Definition\Field\Site;
  3. use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField;
  4. use EasyCorp\Bundle\EasyAdminBundle\Field\DateField;
  5. use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField;
  6. use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
  7. use Lc\SovBundle\Definition\Field\AbstractFieldDefinition;
  8. use Lc\SovBundle\Field\BooleanField;
  9. use Lc\SovBundle\Field\CKEditorField;
  10. use Lc\SovBundle\Field\ImageManagerField;
  11. class NewsFieldDefinition extends AbstractFieldDefinition
  12. {
  13. public function configureIndex(): array
  14. {
  15. return [
  16. 'id',
  17. 'title',
  18. 'status'
  19. ];
  20. }
  21. public function configurePanels(): array
  22. {
  23. return ['main', 'seo', 'opengraph', 'conf'];
  24. }
  25. public function configurePanelMain(): array
  26. {
  27. return [
  28. 'date',
  29. 'title',
  30. 'newsletter',
  31. 'image',
  32. 'description',
  33. 'isSent',
  34. 'status'
  35. ];
  36. }
  37. public function configureFields(): array
  38. {
  39. return [
  40. 'date' => DateField::new('date')
  41. ->setFormat('d/MM/y')
  42. ->setSortable(true),
  43. 'title' => TextField::new('title')->setSortable(true),
  44. 'newsletter' => AssociationField::new('newsletter')->setSortable(true),
  45. 'image' => ImageManagerField::new('image'),
  46. 'position' => NumberField::new('position'),
  47. 'description' => CKEditorField::new('description'),
  48. 'isSent' => BooleanField::new('isSent')->setSortable(true),
  49. ];
  50. }
  51. }