changed pages_display parameter from route to slug

remove imprint and privacy placeholders
This commit is contained in:
tracer 2022-11-03 19:05:36 +01:00
parent 93b60eacb3
commit 1120f1798f

View File

@ -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');
}
}