for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* Lichtenwallner (https://lichtenwallner.at)
*
* @see https://github.com/jolicht/markdown-cms for the canonical source repository
* @license https://github.com/jolicht/markdown-cms/blob/master/LICENSE MIT
* @copyright Copyright (c) Johannes Lichtenwallner
*/
declare(strict_types = 1);
namespace Jolicht\MarkdownCms\Action;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Message\ResponseInterface;
use Zend\Diactoros\Response\HtmlResponse;
use Jolicht\MarkdownCms\Taxonomy\Tag;
class TagArchiveAction extends AbstractAction
{
* {@inheritDoc}
* @see \Jolicht\MarkdownCms\Action\AbstractAction::__invoke()
public function __invoke(ServerRequestInterface $request, ResponseInterface $response, callable $next = null)
$markdownCmsConfig = $this->getMarkdownCmsConfig();
$tagId = $request->getAttribute('id');
$entries = [];
$entryParser = $this->getEntryParser();
foreach ($markdownCmsConfig['content']['content_types']['blogEntry']['tags'][$tagId] as $id) {
$entries[] = $entryParser($id);
}
$data = [
'entries' => $entries,
'tag' => new Tag($tagId)
];
return new HtmlResponse($this->getTemplateRenderer()->render('app::tag-archive.twig', $data));