‪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 
22 use TYPO3Fluid\Fluid\View\TemplateView;
23 
29 {
34  protected ‪$view;
35 
39  public function ‪__construct()
40  {
41  // @todo: Change to StandaloneView when StandaloneView has less dependencies.
42  $this->view = GeneralUtility::makeInstance(TemplateView::class);
43  $this->view->getRenderingContext()
44  ->getTemplatePaths()
45  ->setTemplatePathAndFilename(
46  GeneralUtility::getFileAbsFileName('EXT:core/Resources/Private/Templates/ErrorPage/Error.html')
47  );
48  }
49 
59  public function ‪errorAction(
60  string $title,
61  string $message,
62  int $errorCode = 0,
63  ?int $httpStatusCode = null
64  ): string {
65  $this->view->assign('message', $message);
66  $this->view->assign('title', $title);
67  $this->view->assign('httpStatusCode', $httpStatusCode);
68  $this->view->assign('errorCodeUrlPrefix', ‪Typo3Information::URL_EXCEPTION);
69  $this->view->assign('donationUrl', ‪Typo3Information::URL_DONATE);
70  $this->view->assign('errorCode', $errorCode);
71  $this->view->assign('copyrightYear', GeneralUtility::makeInstance(Typo3Information::class)->getCopyrightYear());
72  return $this->view->render();
73  }
74 }
‪TYPO3\CMS\Core\Information\Typo3Information
Definition: Typo3Information.php:28
‪TYPO3\CMS\Core\Controller\ErrorPageController
Definition: ErrorPageController.php:29
‪TYPO3\CMS\Core\Controller\ErrorPageController\$view
‪TemplateView $view
Definition: ErrorPageController.php:33
‪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:38
‪TYPO3\CMS\Core\Controller\ErrorPageController\errorAction
‪string errorAction(string $title, string $message, int $errorCode=0, ?int $httpStatusCode=null)
Definition: ErrorPageController.php:58
‪TYPO3\CMS\Core\Information\Typo3Information\URL_DONATE
‪const URL_DONATE
Definition: Typo3Information.php:32
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:51