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.

65 rindas
3.0KB

  1. <?php
  2. namespace Lc\CaracoleBundle\Controller\User;
  3. use EasyCorp\Bundle\EasyAdminBundle\Config\Crud;
  4. use EasyCorp\Bundle\EasyAdminBundle\Field\ArrayField;
  5. use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField;
  6. use EasyCorp\Bundle\EasyAdminBundle\Field\DateTimeField;
  7. use EasyCorp\Bundle\EasyAdminBundle\Field\Field;
  8. use EasyCorp\Bundle\EasyAdminBundle\Field\IntegerField;
  9. use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField;
  10. use EasyCorp\Bundle\EasyAdminBundle\Field\TextareaField;
  11. use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
  12. use Lc\CaracoleBundle\Controller\AbstractAdminController;
  13. abstract class GroupUserAdminController extends AbstractAdminController
  14. {
  15. public function configureCrud(Crud $crud): Crud
  16. {
  17. return $crud
  18. ->setSearchFields(['id', 'title', 'description', 'devAlias', 'position', 'status', 'slug', 'image', 'metaTitle', 'metaDescription', 'oldUrls'])
  19. ->setPaginatorPageSize(50)
  20. ->setEntityPermission('ROLE_ADMIN')
  21. ->overrideTemplate('layout', '@LcCaracole/backend/default/layout/layout.html.twig')
  22. ->overrideTemplate('main_menu', '@LcCaracole/backend/default/menu.html.twig')
  23. ->overrideTemplate('crud/edit', '@LcCaracole/backend/default/edit.html.twig')
  24. ->overrideTemplate('crud/index', '@LcCaracole/backend/default/list.html.twig')
  25. ->overrideTemplate('crud/new', '@LcCaracole/backend/default/new.html.twig')
  26. ->overrideTemplate('crud/paginator', '@LcCaracole/backend/default/block/paginator.html.twig');
  27. }
  28. public function configureFields(string $pageName): iterable
  29. {
  30. $title = TextField::new('title');
  31. $devAlias = TextField::new('devAlias');
  32. $id = IntegerField::new('id', 'ID');
  33. $description = TextareaField::new('description');
  34. $createdAt = DateTimeField::new('createdAt');
  35. $updatedAt = DateTimeField::new('updatedAt');
  36. $position = NumberField::new('position');
  37. $status = Field::new('status')->setTemplatePath('@LcShop/backend/default/field/toggle.html.twig');
  38. $slug = TextField::new('slug');
  39. $image = TextField::new('image');
  40. $metaTitle = TextField::new('metaTitle');
  41. $metaDescription = TextareaField::new('metaDescription');
  42. $oldUrls = ArrayField::new('oldUrls');
  43. $merchant = AssociationField::new('merchant');
  44. $users = AssociationField::new('users');
  45. $createdBy = AssociationField::new('createdBy');
  46. $updatedBy = AssociationField::new('updatedBy');
  47. if (Crud::PAGE_INDEX === $pageName) {
  48. return [$title, $status];
  49. } elseif (Crud::PAGE_DETAIL === $pageName) {
  50. return [$id, $title, $description, $devAlias, $createdAt, $updatedAt, $position, $status, $slug, $image, $metaTitle, $metaDescription, $oldUrls, $merchant, $users, $createdBy, $updatedBy];
  51. } elseif (Crud::PAGE_NEW === $pageName) {
  52. return [$title, $devAlias];
  53. } elseif (Crud::PAGE_EDIT === $pageName) {
  54. return [$title, $devAlias];
  55. }
  56. }
  57. }