2021-08-05 13:51:44 +02:00
|
|
|
<?php
|
|
|
|
|
2022-04-26 14:57:59 +02:00
|
|
|
namespace App\Controller;
|
2021-08-05 13:51:44 +02:00
|
|
|
|
2022-04-26 14:57:59 +02:00
|
|
|
use App\Repository\Page;
|
|
|
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
|
|
|
use Symfony\Component\HttpFoundation\Request;
|
2021-08-05 13:51:44 +02:00
|
|
|
use Symfony\Component\HttpFoundation\Response;
|
2022-04-26 14:57:59 +02:00
|
|
|
use Symfony\Component\HttpKernel\KernelInterface;
|
2021-08-05 13:51:44 +02:00
|
|
|
|
2022-04-26 14:57:59 +02:00
|
|
|
class DefaultController extends AbstractController
|
2021-08-05 13:51:44 +02:00
|
|
|
{
|
2022-04-26 14:57:59 +02:00
|
|
|
public function DefaultAction(Request $request, Page $page, KernelInterface $kernel, string $slug = 'index')
|
2021-08-05 13:51:44 +02:00
|
|
|
{
|
2022-04-26 14:57:59 +02:00
|
|
|
$return = $page->getPage($kernel, $slug);
|
|
|
|
$response = new Response('', (int)$return['status']);
|
2023-03-23 11:32:46 +01:00
|
|
|
return $this->render('/page.html.twig', $return, $response);
|
2021-08-05 13:51:44 +02:00
|
|
|
}
|
2021-08-06 12:30:00 +02:00
|
|
|
|
2022-04-26 14:57:59 +02:00
|
|
|
public function ErrorAction(Request $request, Page $page, KernelInterface $kernel, string $status)
|
2021-08-06 12:30:00 +02:00
|
|
|
{
|
2022-04-26 14:57:59 +02:00
|
|
|
$return = $page->getPage($kernel, 'error/' . $status);
|
|
|
|
$response = new Response('', (int)$status);
|
2023-03-23 11:32:46 +01:00
|
|
|
return $this->render('/page.html.twig', $return, $response);
|
2021-08-06 12:30:00 +02:00
|
|
|
}
|
2022-04-26 14:57:59 +02:00
|
|
|
}
|