From 1120f1798f4ef9210fe9289247488e3db28acae2 Mon Sep 17 00:00:00 2001 From: tracer Date: Thu, 3 Nov 2022 19:05:36 +0100 Subject: [PATCH] changed pages_display parameter from route to slug remove imprint and privacy placeholders --- src/Controller/PagesController.php | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/src/Controller/PagesController.php b/src/Controller/PagesController.php index 6638c81..0f51151 100644 --- a/src/Controller/PagesController.php +++ b/src/Controller/PagesController.php @@ -10,33 +10,23 @@ use Symfony\Component\Routing\Annotation\Route; class PagesController extends AbstractController { - #[Route(path: '/pages/{name}', name: 'pages_display')] - public function display(PagesRepository $pagesRepository, string $name): Response + #[Route(path: '/pages/{slug}', name: 'pages_display')] + public function display(PagesRepository $pagesRepository, string $slug): Response { $page = $pagesRepository->findOneBy([ - 'slug' => $name, + 'slug' => $slug, ]); if (!$page) { $page = new Pages(); $page->setName(name: 'Not Found'); - $page->setContent(content: 'The requested page was not found.'); + $page->setContent(content: '404 - The requested page was not found.'); } - return $this->render(view: '@default/pages/display.html.twig', parameters: [ - 'page' => $page, + return $this->render(view: '@default/pages/index.html.twig', parameters: [ + 'page_name' => $page->getName(), + 'page_content' => $page->getContent() + ]); } - - #[Route(path: '/imprint', name: 'app_imprint')] - public function imprint(): Response - { - return $this->render(view: '@default/pages/imprint.html.twig'); - } - - #[Route(path: '/privacy', name: 'app_privacy')] - public function privacy(): Response - { - return $this->render(view: '@default/pages/privacy.html.twig'); - } }