‪TYPO3CMS  10.4
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 
42  public static function ‪simulateFrontendEnvironment(‪ContentObjectRenderer $cObj = null): void
43  {
44  self::$tsfeBackup = ‪$GLOBALS['TSFE'] ?? null;
45  ‪$GLOBALS['TSFE'] = new \stdClass();
46  ‪$GLOBALS['TSFE']->cObjectDepthCounter = 100;
47  ‪$GLOBALS['TSFE']->cObj = $cObj ?? GeneralUtility::makeInstance(ContentObjectRenderer::class);
48  }
49 
55  public static function ‪resetFrontendEnvironment(): void
56  {
57  if (self::$tsfeBackup !== null) {
59  }
60  }
61 }
‪TYPO3\CMS\Extbase\Utility\FrontendSimulatorUtility
Definition: FrontendSimulatorUtility.php:30
‪TYPO3\CMS\Extbase\Utility\FrontendSimulatorUtility\simulateFrontendEnvironment
‪static simulateFrontendEnvironment(ContentObjectRenderer $cObj=null)
Definition: FrontendSimulatorUtility.php:41
‪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:54
‪TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController
Definition: TypoScriptFrontendController.php:98
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:5
‪TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer
Definition: ContentObjectRenderer.php:97
‪TYPO3\CMS\Extbase\Utility
Definition: DebuggerUtility.php:18
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:46