|
|
@@ -0,0 +1,64 @@ |
|
|
|
<?php |
|
|
|
|
|
|
|
namespace Lc\CaracoleBundle\Controller\User; |
|
|
|
|
|
|
|
use EasyCorp\Bundle\EasyAdminBundle\Config\Crud; |
|
|
|
use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController; |
|
|
|
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; |
|
|
|
|
|
|
|
abstract class GroupUserCrudController extends AbstractCrudController |
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
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', '@LcShop/backend/default/layout/layout.html.twig') |
|
|
|
->overrideTemplate('menu', '@LcShop/backend/default/menu.html.twig') |
|
|
|
->overrideTemplate('crud/edit', '@LcShop/backend/default/edit.html.twig') |
|
|
|
->overrideTemplate('crud/index', '@LcShop/backend/default/list.html.twig') |
|
|
|
->overrideTemplate('crud/new', '@LcShop/backend/default/new.html.twig') |
|
|
|
->overrideTemplate('crud/paginator', '@LcShop/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]; |
|
|
|
} |
|
|
|
} |
|
|
|
} |