changed pages_display parameter from route to slug
remove imprint and privacy placeholders
This commit is contained in:
parent
93b60eacb3
commit
1120f1798f
|
@ -10,33 +10,23 @@ use Symfony\Component\Routing\Annotation\Route;
|
||||||
|
|
||||||
class PagesController extends AbstractController
|
class PagesController extends AbstractController
|
||||||
{
|
{
|
||||||
#[Route(path: '/pages/{name}', name: 'pages_display')]
|
#[Route(path: '/pages/{slug}', name: 'pages_display')]
|
||||||
public function display(PagesRepository $pagesRepository, string $name): Response
|
public function display(PagesRepository $pagesRepository, string $slug): Response
|
||||||
{
|
{
|
||||||
$page = $pagesRepository->findOneBy([
|
$page = $pagesRepository->findOneBy([
|
||||||
'slug' => $name,
|
'slug' => $slug,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if (!$page) {
|
if (!$page) {
|
||||||
$page = new Pages();
|
$page = new Pages();
|
||||||
$page->setName(name: 'Not Found');
|
$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: [
|
return $this->render(view: '@default/pages/index.html.twig', parameters: [
|
||||||
'page' => $page,
|
'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');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue