update crud of posts
This commit is contained in:
parent
da5b23c1b0
commit
8755b35b71
|
@ -19,6 +19,7 @@ use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Component\HttpFoundation\Session\Session;
|
use Symfony\Component\HttpFoundation\Session\Session;
|
||||||
use Symfony\Component\Routing\Annotation\Route;
|
use Symfony\Component\Routing\Annotation\Route;
|
||||||
use Symfony\Component\Form\Form;
|
use Symfony\Component\Form\Form;
|
||||||
|
use App\Core\Entity\EntityInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Route("/admin/blog/post")
|
* @Route("/admin/blog/post")
|
||||||
|
@ -50,13 +51,19 @@ class PostAdminController extends CrudController
|
||||||
->setView('form', 'blog/post_admin/_form.html.twig')
|
->setView('form', 'blog/post_admin/_form.html.twig')
|
||||||
->setView('edit', 'blog/post_admin/edit.html.twig')
|
->setView('edit', 'blog/post_admin/edit.html.twig')
|
||||||
|
|
||||||
->setDefaultSort('index', 'publishedAt', 'desc')
|
->setDefaultSort('index', 'id', 'desc')
|
||||||
|
|
||||||
->setField('index', 'Titre', TextField::class, [
|
->setField('index', 'Titre', TextField::class, [
|
||||||
'view' => 'blog/post_admin/field/title.html.twig',
|
'view' => 'blog/post_admin/field/title.html.twig',
|
||||||
'sort' => ['title', '.title'],
|
'sort' => ['title', '.title'],
|
||||||
'attr' => ['class' => 'miw-400'],
|
'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, [
|
->setField('index', 'Mise à jour', DatetimeField::class, [
|
||||||
'property' => 'updatedAt',
|
'property' => 'updatedAt',
|
||||||
'format' => 'd/m/Y H:i',
|
'format' => 'd/m/Y H:i',
|
||||||
|
|
Loading…
Reference in a new issue