reorganized menu

This commit is contained in:
tracer 2022-04-12 19:01:14 +02:00
parent e65044fe79
commit ba9ff09b54
1 changed files with 20 additions and 7 deletions

View File

@ -4,6 +4,11 @@ namespace App\Controller\Admin;
use App\Entity\User; use App\Entity\User;
use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController; use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController;
use EasyCorp\Bundle\EasyAdminBundle\Field\ChoiceField;
use EasyCorp\Bundle\EasyAdminBundle\Field\EmailField;
use EasyCorp\Bundle\EasyAdminBundle\Field\IdField;
use EasyCorp\Bundle\EasyAdminBundle\Field\ImageField;
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
/** /**
* *
@ -15,14 +20,22 @@ class UserCrudController extends AbstractCrudController
return User::class; return User::class;
} }
/*
public function configureFields(string $pageName): iterable public function configureFields(string $pageName): iterable
{ {
return [ yield IdField::new(propertyName: 'id')
IdField::new('id'), ->onlyOnIndex();
TextField::new('title'), yield TextField::new(propertyName: 'firstName');
TextEditorField::new('description'), yield TextField::new(propertyName: 'lastName');
]; yield EmailField::new(propertyName: 'email');
yield ImageField::new(propertyName: 'avatar')
->setBasePath(path: 'uploads/avatars')
->setUploadDir(uploadDirPath: 'public/uploads/avatars')
->setUploadedFileNamePattern(patternOrCallable: '[timestamp]-[slug].[extension]');
$roles = ['ROLE_FOUNDER', 'ROLE_ADMIN', 'ROLE_MODERATOR', 'ROLE_USER'];
yield ChoiceField::new(propertyName: 'roles')
->setChoices(choiceGenerator: array_combine(keys: $roles, values: $roles))
->allowMultipleChoices()
->renderExpanded()
->renderAsBadges();
} }
*/
} }