Tsfe.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. namespace Opentalent\OtTemplating\Utility;
  3. use TYPO3\CMS\Core\Site\Entity\SiteInterface;
  4. use TYPO3\CMS\Core\Site\SiteFinder;
  5. use TYPO3\CMS\Core\Utility\GeneralUtility;
  6. class Tsfe
  7. {
  8. public function initializeFrontEndRendering($pageId = 0)
  9. {
  10. $siteFinder = GeneralUtility::makeInstance(SiteFinder::class);
  11. /** @var SiteInterface $site */
  12. $site = $siteFinder->getSiteByPageId($pageId);
  13. $GLOBALS['TSFE'] = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
  14. 'TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController',
  15. $GLOBALS['TYPO3_CONF_VARS'],
  16. $site,
  17. $site->getDefaultLanguage()
  18. );
  19. $GLOBALS['TSFE']->set_no_cache();
  20. $GLOBALS['TSFE']->fe_user = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Frontend\Authentication\FrontendUserAuthentication::class);
  21. $GLOBALS['TSFE']->fe_user->checkPid_value = 0;
  22. $GLOBALS['TSFE']->fe_user->start();
  23. $GLOBALS['TSFE']->fe_user->unpack_uc();
  24. $GLOBALS['TSFE']->determineId();
  25. $GLOBALS['TSFE']->getConfigArray();
  26. $GLOBALS['TSFE']->cObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer');
  27. $GLOBALS['TSFE']->settingLanguage();
  28. $GLOBALS['TSFE']->settingLocale();
  29. }
  30. }