<?php
namespace App\Controller\Frontend;
use App\Application\Content\ContentFrontendData;
use App\Application\Content\ContentService;
use App\Application\Redaktor\RedaktorFrontendData;
use App\Application\Redaktor\RedaktorService;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Cache;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
#[Cache(expires: '+10 minutes')]
class PageController extends AbstractController
{
#[Route(path: '/redaktion', name: 'fe.page_redaktion')]
public function redaktion(ContentService $contentService, RedaktorService $redaktorService): Response
{
$content = $contentService->getContentByCode('REDAKTION', new ContentFrontendData(), true);
$redaktoren = $redaktorService->findAllShowOnFrontend(new RedaktorFrontendData());
return $this->render('frontend/page/redaktion.html.twig', [
'content' => $content,
'redaktoren' => $redaktoren,
]);
}
#[Route(path: '/impressum', name: 'fe.page_impressum')]
#[Route(path: '/impressum.html', defaults: ['legacyUrl' => true])]
public function impressum(ContentService $contentService, $legacyUrl = false): RedirectResponse|Response
{
// datenschutz.html benötigt für UW-APP, soll dann aber direkt redirected werden
if ($legacyUrl) {
return $this->redirectToRoute('fe.page_impressum', [], 301);
}
$content = $contentService->getContentByCode('IMPRESSUM', new ContentFrontendData(), true);
return $this->render('frontend/page/page-template.html.twig', [
'h1_title' => 'Impressum',
'content' => $content,
]);
}
#[Route(path: '/datenschutz', name: 'fe.page_datenschutz')]
#[Route(path: '/datenschutz.html', defaults: ['legacyUrl' => true])]
public function datenschutz(ContentService $contentService, $legacyUrl = false): RedirectResponse|Response
{
// datenschutz.html benötigt für UW-APP, soll dann aber direkt redirected werden
if ($legacyUrl) {
return $this->redirectToRoute('fe.page_datenschutz', [], 301);
}
$content = $contentService->getContentByCode('DATENSCHUTZ', new ContentFrontendData(), true);
return $this->render('frontend/page/page-template.html.twig', [
'h1_title' => 'Datenschutz',
'content' => $content,
]);
}
#[Route(path: '/disclaimer', name: 'fe.page_disclaimer')]
#[Route(path: '/disclaimer.html', defaults: ['legacyUrl' => true])]
public function disclaimer(ContentService $contentService, $legacyUrl = false): RedirectResponse|Response
{
// disclaimer.html benötigt für UW-APP, soll dann aber direkt redirected werden
if ($legacyUrl) {
return $this->redirectToRoute('fe.page_disclaimer', [], 301);
}
$content = $contentService->getContentByCode('DISCLAIMER', new ContentFrontendData(), true);
return $this->render('frontend/page/page-template.html.twig', [
'h1_title' => 'Disclaimer',
'content' => $content,
]);
}
#[Route(path: '/inserieren', name: 'fe.page_inserieren')]
public function werbung(ContentService $contentService): Response
{
$content = $contentService->getContentByCode('INSERIEREN', new ContentFrontendData(), true);
return $this->render('frontend/page/page-template.html.twig', [
'h1_title' => 'Inserieren',
'content' => $content,
]);
}
#[Route(path: '/uw-app', name: 'fe.page_uwapp')]
public function epaperUWApp(ContentService $contentService): Response
{
$content = $contentService->getContentByCode('UW-APP', new ContentFrontendData(), true);
return $this->render('frontend/page/page-template.html.twig', [
'h1_title' => 'UW-App',
'content' => $content,
]);
}
#[Route(path: '/todesanzeigen', name: 'fe.page_todesanzeigen')]
public function todesanzeigen(ContentService $contentService): Response
{
$content = $contentService->getContentByCode('TODESANZEIGEN', new ContentFrontendData(), true);
return $this->render('frontend/page/page-template.html.twig', [
'h1_title' => 'Todesanzeigen',
'content' => $content,
]);
}
#[Route(path: '/faq', name: 'fe.page_faq')]
public function faq(ContentService $contentService): Response
{
$content = $contentService->getContentByCode('ACCORDION_FAQ', new ContentFrontendData(), true);
return $this->render('frontend/page/page-template.html.twig', [
'h1_title' => 'FAQ',
'content' => $content,
]);
}
}