TYPO3 CMS  TYPO3_8-7
ErrorPageController.php
Go to the documentation of this file.
1 <?php
2 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 
25 
31 {
36  protected $view;
37 
43 
47  public function __construct()
48  {
49  $this->view = GeneralUtility::makeInstance(TemplateView::class);
50  $context = new RenderingContext($this->view);
51  $context->setControllerName('ErrorPage');
52  $context->setTemplatePaths(new TemplatePaths([
53  'templateRootPaths' => [
54  ExtensionManagementUtility::extPath('core', 'Resources/Private/Templates/ErrorPage/')
55  ]
56  ]));
57  $this->view->setRenderingContext($context);
58  }
59 
69  public function errorAction(
70  string $title,
71  string $message,
73  int $errorCode = 0
74  ): string {
75  $this->severity = $severity;
76  $classes = [
77  AbstractMessage::NOTICE => 'notice',
78  AbstractMessage::INFO => 'information',
79  AbstractMessage::OK => 'ok',
80  AbstractMessage::WARNING => 'warning',
81  AbstractMessage::ERROR => 'error'
82  ];
83  $this->view->assign('severityCssClass', $classes[$this->severity]);
84  $this->view->assign('severity', $this->severity);
85  $this->view->assign('message', $message);
86  $this->view->assign('title', $title);
87  $this->view->assign('errorCodeUrlPrefix', TYPO3_URL_EXCEPTION);
88  $this->view->assign('errorCode', $errorCode);
89  $this->view->assign('logo', PathUtility::getAbsoluteWebPath(ExtensionManagementUtility::extPath('backend', 'Resources/Public/Images/typo3_orange.svg')));
90  $this->view->assign('cssFile', PathUtility::getAbsoluteWebPath(ExtensionManagementUtility::extPath('core', 'Resources/Public/Css/errorpage.css')));
91  $this->view->assign('copyrightYear', TYPO3_copyright_year);
92  return $this->view->render('Error');
93  }
94 }
static getAbsoluteWebPath($targetPath)
Definition: PathUtility.php:40
static makeInstance($className,... $constructorArguments)
errorAction(string $title, string $message, int $severity=AbstractMessage::ERROR, int $errorCode=0)