‪TYPO3CMS  9.5
NotFoundView.php
Go to the documentation of this file.
1 <?php
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
22 {
26  protected ‪$variablesMarker = ['errorMessage' => 'ERROR_MESSAGE'];
27 
34  public function ‪render()
35  {
36  if (!is_object($this->controllerContext->getRequest())) {
37  throw new \TYPO3\CMS\Extbase\Mvc\Exception('Can\'t render view without request object.', 1192450280);
38  }
39  $template = file_get_contents($this->‪getTemplatePathAndFilename());
40  if ($this->controllerContext->getRequest() instanceof \‪TYPO3\CMS\‪Extbase\Mvc\Web\‪Request) {
41  $template = str_replace('###BASEURI###', \‪TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL'), $template);
42  }
43  foreach ($this->variablesMarker as $variableName => $marker) {
44  $variableValue = $this->variables[$variableName] ?? '';
45  $template = str_replace('###' . $marker . '###', $variableValue, $template);
46  }
47  return $template;
48  }
49 
55  protected function ‪getTemplatePathAndFilename()
56  {
57  return \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('extbase') . 'Resources/Private/MVC/NotFoundView_Template.html';
58  }
59 
71  public function ‪__call($methodName, array $arguments)
72  {
73  }
74 }
‪TYPO3\CMS\Extbase\Mvc\View\NotFoundView
Definition: NotFoundView.php:22
‪TYPO3\CMS\Extbase\Annotation
Definition: IgnoreValidation.php:4
‪TYPO3\CMS\Extbase\Mvc\View\NotFoundView\getTemplatePathAndFilename
‪string getTemplatePathAndFilename()
Definition: NotFoundView.php:54
‪TYPO3
‪TYPO3\CMS\Extbase\Mvc\View\NotFoundView\render
‪string render()
Definition: NotFoundView.php:33
‪TYPO3\CMS\Extbase\Mvc\View\NotFoundView\__call
‪__call($methodName, array $arguments)
Definition: NotFoundView.php:70
‪TYPO3\CMS\Extbase\Mvc\View\NotFoundView\$variablesMarker
‪array $variablesMarker
Definition: NotFoundView.php:25
‪TYPO3\CMS\Extbase\Mvc\View
Definition: AbstractView.php:2
‪TYPO3\CMS\Extbase\Mvc\Request
Definition: Request.php:23
‪TYPO3\CMS\Extbase\Mvc\View\AbstractView
Definition: AbstractView.php:21