‪TYPO3CMS  ‪main
ErrorPageController.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
23 use TYPO3Fluid\Fluid\View\TemplateView;
24 
30 {
35  protected ‪$view;
36 
40  public function ‪__construct()
41  {
42  // @todo: Change to StandaloneView when StandaloneView has less dependencies.
43  $this->view = GeneralUtility::makeInstance(TemplateView::class);
44  $this->view->getRenderingContext()
45  ->getTemplatePaths()
46  ->setTemplatePathAndFilename(
47  GeneralUtility::getFileAbsFileName('EXT:core/Resources/Private/Templates/ErrorPage/Error.html')
48  );
49  }
50 
60  public function ‪errorAction(
61  string $title,
62  string $message,
63  int $errorCode = 0,
64  ?int $httpStatusCode = null
65  ): string {
66  $this->view->assign('message', $message);
67  $this->view->assign('title', $title);
68  $this->view->assign('httpStatusCode', $httpStatusCode);
69  $this->view->assign('errorCodeUrlPrefix', ‪Typo3Information::URL_EXCEPTION);
70  $this->view->assign('donationUrl', ‪Typo3Information::URL_DONATE);
71  $this->view->assign('errorCode', $errorCode);
72  $this->view->assign('requestId', GeneralUtility::makeInstance(RequestId::class));
73  $this->view->assign('copyrightYear', GeneralUtility::makeInstance(Typo3Information::class)->getCopyrightYear());
74  return $this->view->render();
75  }
76 }
‪TYPO3\CMS\Core\Information\Typo3Information
Definition: Typo3Information.php:28
‪TYPO3\CMS\Core\Controller\ErrorPageController
Definition: ErrorPageController.php:30
‪TYPO3\CMS\Core\Controller\ErrorPageController\$view
‪TemplateView $view
Definition: ErrorPageController.php:34
‪TYPO3\CMS\Core\Information\Typo3Information\URL_EXCEPTION
‪const URL_EXCEPTION
Definition: Typo3Information.php:31
‪TYPO3\CMS\Core\Controller
Definition: ErrorPageController.php:18
‪TYPO3\CMS\Core\Controller\ErrorPageController\__construct
‪__construct()
Definition: ErrorPageController.php:39
‪TYPO3\CMS\Core\Controller\ErrorPageController\errorAction
‪string errorAction(string $title, string $message, int $errorCode=0, ?int $httpStatusCode=null)
Definition: ErrorPageController.php:59
‪TYPO3\CMS\Core\Core\RequestId
Definition: RequestId.php:26
‪TYPO3\CMS\Core\Information\Typo3Information\URL_DONATE
‪const URL_DONATE
Definition: Typo3Information.php:32
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:52