update crud of posts

This commit is contained in:
Simon Vieille 2022-01-15 12:14:32 +01:00
parent da5b23c1b0
commit 8755b35b71
1 changed files with 9 additions and 2 deletions

View File

@ -19,6 +19,7 @@ use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Session\Session;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Form\Form;
use App\Core\Entity\EntityInterface;
/**
* @Route("/admin/blog/post")
@ -50,13 +51,19 @@ class PostAdminController extends CrudController
->setView('form', 'blog/post_admin/_form.html.twig')
->setView('edit', 'blog/post_admin/edit.html.twig')
->setDefaultSort('index', 'publishedAt', 'desc')
->setDefaultSort('index', 'id', 'desc')
->setField('index', 'Titre', TextField::class, [
'view' => 'blog/post_admin/field/title.html.twig',
'sort' => ['title', '.title'],
'attr' => ['class' => 'miw-400'],
])
->setField('index', 'ID', TextField::class, [
'property_builder' => function(EntityInterface $entity) {
return sprintf('#%d', $entity->getId());
},
'sort' => ['id', '.id'],
'attr' => ['class' => 'miw-90'],
])
->setField('index', 'Mise à jour', DatetimeField::class, [
'property' => 'updatedAt',
'format' => 'd/m/Y H:i',