|
- <?php
-
- namespace Lc\CaracoleBundle\Controller\User;
-
- use EasyCorp\Bundle\EasyAdminBundle\Config\Crud;
- use EasyCorp\Bundle\EasyAdminBundle\Field\ArrayField;
- use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField;
- use EasyCorp\Bundle\EasyAdminBundle\Field\DateTimeField;
- use EasyCorp\Bundle\EasyAdminBundle\Field\Field;
- use EasyCorp\Bundle\EasyAdminBundle\Field\IntegerField;
- use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField;
- use EasyCorp\Bundle\EasyAdminBundle\Field\TextareaField;
- use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
- use Lc\CaracoleBundle\Controller\AbstractAdminController;
-
- abstract class GroupUserAdminController extends AbstractAdminController
- {
-
-
- public function configureCrud(Crud $crud): Crud
- {
- return $crud
- ->setSearchFields(['id', 'title', 'description', 'devAlias', 'position', 'status', 'slug', 'image', 'metaTitle', 'metaDescription', 'oldUrls'])
- ->setPaginatorPageSize(50)
- ->setEntityPermission('ROLE_ADMIN')
- ->overrideTemplate('layout', '@LcCaracole/backend/default/layout/layout.html.twig')
- ->overrideTemplate('main_menu', '@LcCaracole/backend/default/menu.html.twig')
- ->overrideTemplate('crud/edit', '@LcCaracole/backend/default/edit.html.twig')
- ->overrideTemplate('crud/index', '@LcCaracole/backend/default/list.html.twig')
- ->overrideTemplate('crud/new', '@LcCaracole/backend/default/new.html.twig')
- ->overrideTemplate('crud/paginator', '@LcCaracole/backend/default/block/paginator.html.twig');
- }
-
- public function configureFields(string $pageName): iterable
- {
- $title = TextField::new('title');
- $devAlias = TextField::new('devAlias');
- $id = IntegerField::new('id', 'ID');
- $description = TextareaField::new('description');
- $createdAt = DateTimeField::new('createdAt');
- $updatedAt = DateTimeField::new('updatedAt');
- $position = NumberField::new('position');
- $status = Field::new('status')->setTemplatePath('@LcShop/backend/default/field/toggle.html.twig');
- $slug = TextField::new('slug');
- $image = TextField::new('image');
- $metaTitle = TextField::new('metaTitle');
- $metaDescription = TextareaField::new('metaDescription');
- $oldUrls = ArrayField::new('oldUrls');
- $merchant = AssociationField::new('merchant');
- $users = AssociationField::new('users');
- $createdBy = AssociationField::new('createdBy');
- $updatedBy = AssociationField::new('updatedBy');
-
- if (Crud::PAGE_INDEX === $pageName) {
- return [$title, $status];
- } elseif (Crud::PAGE_DETAIL === $pageName) {
- return [$id, $title, $description, $devAlias, $createdAt, $updatedAt, $position, $status, $slug, $image, $metaTitle, $metaDescription, $oldUrls, $merchant, $users, $createdBy, $updatedBy];
- } elseif (Crud::PAGE_NEW === $pageName) {
- return [$title, $devAlias];
- } elseif (Crud::PAGE_EDIT === $pageName) {
- return [$title, $devAlias];
- }
- }
- }
|