This commit is contained in:
2022-02-15 07:33:00 +01:00
commit 50638af575
52 changed files with 7293 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
<?php
declare(strict_types=1);
namespace App\Presenters;
use Nette;
final class Error4xxPresenter extends Nette\Application\UI\Presenter
{
public function startup(): void
{
parent::startup();
if (!$this->getRequest()->isMethod(Nette\Application\Request::FORWARD)) {
$this->error();
}
}
public function renderDefault(Nette\Application\BadRequestException $exception): void
{
// load template 403.latte or 404.latte or ... 4xx.latte
$file = __DIR__ . "/templates/Error/{$exception->getCode()}.latte";
$this->template->setFile(is_file($file) ? $file : __DIR__ . '/templates/Error/4xx.latte');
}
}