FluidTYPO3\Vhs\ViewHelpers\Media\Image\AbstractImageViewHelper::simulateFrontendEnvironment PHP Method

simulateFrontendEnvironment() protected method

Prepares $GLOBALS['TSFE'] for Backend mode This somewhat hacky work around is currently needed because the getImgResource() function of \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer relies on those variables to be set
protected simulateFrontendEnvironment ( ) : void
return void
    protected function simulateFrontendEnvironment()
    {
        $this->tsfeBackup = true === isset($GLOBALS['TSFE']) ? $GLOBALS['TSFE'] : null;
        $this->workingDirectoryBackup = getcwd();
        chdir(constant('PATH_site'));
        $typoScriptSetup = $this->configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT);
        $GLOBALS['TSFE'] = new \stdClass();
        $template = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\TypoScript\\TemplateService');
        $template->tt_track = 0;
        $template->init();
        $template->getFileName_backPath = constant('PATH_site');
        $GLOBALS['TSFE']->tmpl = $template;
        $GLOBALS['TSFE']->tmpl->setup = $typoScriptSetup;
        $GLOBALS['TSFE']->config = $typoScriptSetup;
    }