‪TYPO3CMS  10.4
NotFoundView.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of the TYPO3 CMS project.
5  *
6  * It is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU General Public License, either version 2
8  * of the License, or any later version.
9  *
10  * For the full copyright and license information, please read the
11  * LICENSE.txt file that was distributed with this source code.
12  *
13  * The TYPO3 project - inspiring people to share!
14  */
15 
17 
22 
28 {
32  protected ‪$variablesMarker = ['errorMessage' => 'ERROR_MESSAGE'];
33 
40  public function ‪render()
41  {
42  if (!is_object($this->controllerContext->getRequest())) {
43  throw new ‪Exception('Can\'t render view without request object.', 1192450280);
44  }
45  $template = file_get_contents($this->‪getTemplatePathAndFilename());
46  $template = is_string($template) ? $template : '';
47  if ($this->controllerContext->getRequest() instanceof ‪Request) {
48  $template = str_replace('###BASEURI###', GeneralUtility::getIndpEnv('TYPO3_SITE_URL'), $template);
49  }
50  foreach ($this->variablesMarker as $variableName => $marker) {
51  $variableValue = $this->variables[$variableName] ?? '';
52  $template = str_replace('###' . $marker . '###', $variableValue, $template);
53  }
54  return $template;
55  }
56 
62  protected function ‪getTemplatePathAndFilename()
63  {
64  return ‪ExtensionManagementUtility::extPath('extbase') . 'Resources/Private/MVC/NotFoundView_Template.html';
65  }
66 
78  public function ‪__call($methodName, array $arguments)
79  {
80  }
81 }
‪TYPO3\CMS\Extbase\Mvc\Exception
Definition: Exception.php:26
‪TYPO3\CMS\Extbase\Mvc\View\NotFoundView
Definition: NotFoundView.php:28
‪TYPO3\CMS\Extbase\Mvc\View\NotFoundView\getTemplatePathAndFilename
‪string getTemplatePathAndFilename()
Definition: NotFoundView.php:61
‪TYPO3\CMS\Extbase\Mvc\View\NotFoundView\render
‪string render()
Definition: NotFoundView.php:39
‪TYPO3\CMS\Core\Utility\ExtensionManagementUtility
Definition: ExtensionManagementUtility.php:43
‪TYPO3\CMS\Extbase\Mvc\View\NotFoundView\__call
‪__call($methodName, array $arguments)
Definition: NotFoundView.php:77
‪TYPO3\CMS\Extbase\Mvc\View\NotFoundView\$variablesMarker
‪array $variablesMarker
Definition: NotFoundView.php:31
‪TYPO3\CMS\Extbase\Mvc\Exception
Definition: InfiniteLoopException.php:18
‪TYPO3\CMS\Extbase\Mvc\Web\Request
Definition: Request.php:23
‪TYPO3\CMS\Core\Utility\ExtensionManagementUtility\extPath
‪static string extPath($key, $script='')
Definition: ExtensionManagementUtility.php:127
‪TYPO3\CMS\Extbase\Mvc\View
Definition: AbstractView.php:16
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:46
‪TYPO3\CMS\Extbase\Mvc\View\AbstractView
Definition: AbstractView.php:24