Search code examples
typo3typo3-extensions

How to correctly initialize $GLOBALS['TSFE']


In my TYPO3 extension, I made a custom controller class that is called from some hook in the TYPO3 backend.

In this controller I would like to get some stuff from $GLOBALS['TSFE'] but when I do var_dump($GLOBALS['TSFE']) I receive null. The question is how can I correctly initialize $GLOBALS['TSFE']?


Solution

  • try something like this:

    $GLOBALS['TSFE'] = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController',$GLOBALS['TYPO3_CONF_VARS'], $id, $type);