Browse Source

update crud of posts

develop
Simon Vieille 2 weeks ago
parent
commit
8755b35b71
  1. 11
      src/Controller/Blog/PostAdminController.php

11
src/Controller/Blog/PostAdminController.php

@ -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',

Loading…
Cancel
Save