45 lines
1.0 KiB
PHP
45 lines
1.0 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Application\Controller;
|
|
|
|
use Application\Content\CockpitApi;
|
|
use Exception;
|
|
use GuzzleHttp\Exception\GuzzleException;
|
|
|
|
class ArticleController extends MainController
|
|
{
|
|
/**
|
|
* @throws Exception
|
|
* @throws GuzzleException
|
|
*/
|
|
protected function action(): void
|
|
{
|
|
$article = (new CockpitApi())->getArticle($this->getRouteParams('id'));
|
|
|
|
$this->getBreadcrumbs()->addBreadcrumb(
|
|
$article->getTitle(),
|
|
$article->getUrl()
|
|
);
|
|
|
|
$this->pushToStash('article', [
|
|
'subtitle' => 'TODO: Subtitle',
|
|
'title' => $article->getTitle(),
|
|
'lead' => $article->getExcerpt(),
|
|
'text' => $article->getText(),
|
|
'image' => [
|
|
'src' => $article->getImage()->getImageUrl(),
|
|
'width' => $article->getImage()->getWidth(),
|
|
'height' => $article->getImage()->getHeight(),
|
|
'alt' => 'lorem ipsum',
|
|
],
|
|
]);
|
|
}
|
|
|
|
protected function getTemplate(): string
|
|
{
|
|
return '04_templates/t-article/t-article.twig';
|
|
}
|
|
}
|