‪TYPO3CMS  ‪main
FrontendSimulatorUtility.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 
30 {
34  protected static ‪$tsfeBackup;
35 
41  public static function ‪simulateFrontendEnvironment(‪ContentObjectRenderer $cObj = null): void
42  {
43  self::$tsfeBackup = ‪$GLOBALS['TSFE'] ?? null;
44  ‪$GLOBALS['TSFE'] = new \stdClass();
45  ‪$GLOBALS['TSFE']->cObj = $cObj ?? GeneralUtility::makeInstance(ContentObjectRenderer::class);
46  }
47 
53  public static function ‪resetFrontendEnvironment(): void
54  {
55  if (self::$tsfeBackup !== null) {
57  }
58  }
59 }
‪TYPO3\CMS\Extbase\Utility\FrontendSimulatorUtility
Definition: FrontendSimulatorUtility.php:30
‪TYPO3\CMS\Extbase\Utility\FrontendSimulatorUtility\simulateFrontendEnvironment
‪static simulateFrontendEnvironment(ContentObjectRenderer $cObj=null)
Definition: FrontendSimulatorUtility.php:40
‪TYPO3\CMS\Extbase\Utility\FrontendSimulatorUtility\$tsfeBackup
‪static TypoScriptFrontendController null $tsfeBackup
Definition: FrontendSimulatorUtility.php:33
‪TYPO3\CMS\Extbase\Utility\FrontendSimulatorUtility\resetFrontendEnvironment
‪static resetFrontendEnvironment()
Definition: FrontendSimulatorUtility.php:52
‪TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController
Definition: TypoScriptFrontendController.php:58
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:25
‪TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer
Definition: ContentObjectRenderer.php:102
‪TYPO3\CMS\Extbase\Utility
Definition: DebuggerUtility.php:18
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:52