This commit is contained in:
Simon Vieille 2022-03-27 19:38:22 +02:00
parent 50a8f15a73
commit d0f6326501

View file

@ -19,6 +19,7 @@ use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use App\Factory\Blog\PostFollowFactory;
use App\Manager\PostFollowManager;
use App\Core\Twig\Extension\EditorJsExtension;
class PostController extends PageController
{
@ -161,17 +162,23 @@ class PostController extends PageController
;
}
public function rss(PostParser $parser): Response
public function rss(PostParser $parser, EditorJsExtension $editorJsExtension): Response
{
$entities = $this->createQuery()->paginate(1, 20);
$items = [];
foreach ($entities as $entity) {
if ($entity->getContentFormat() === 'editorjs') {
$description = $editorJsExtension->buildHtml($entity->getContent());
} else {
$description = $parser->transformMarkdown($entity->getContent());
}
$items[] = [
'title' => $entity->getTitle(),
'guid' => $entity->getId(),
'date' => $entity->getPublishedAt(),
'description' => $parser->transformMarkdown($entity->getContent()),
'description' => $description,
'categories' => call_user_func(function () use ($entity) {
foreach ($entity->getCategories() as $category) {
if ($category->getIsActive()) {