Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace Serfhos\MyLibrary\Utility;
- /**
- * Utility: Initialize objects inside EID usage
- */
- class EidUtility
- {
- /**
- * Initialize TSFE based on given page id
- *
- * @param integer $pageId
- * @return void
- */
- public static function initializeTypoScriptFrontendController($pageId = 0)
- {
- global $TYPO3_CONF_VARS;
- // fallback for timetracker
- if (!is_object($GLOBALS['TT'])) {
- $GLOBALS['TT'] = new \TYPO3\CMS\Core\TimeTracker\NullTimeTracker();
- }
- $controller = & $GLOBALS['TSFE'];
- if (!($controller instanceof \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController)) {
- $controller = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
- 'TYPO3\\CMS\\Frontend\\Controller\\TypoScriptFrontendController', $TYPO3_CONF_VARS, $pageId, 0
- );
- \TYPO3\CMS\Core\Core\Bootstrap::getInstance()->loadCachedTca();
- }
- if (!($controller->fe_user instanceof \TYPO3\CMS\Frontend\Authentication\FrontendUserAuthentication)) {
- $controller->initFEuser();
- }
- if (!($controller->sys_page instanceof \TYPO3\CMS\Frontend\Page\PageRepository)) {
- $controller->determineId();
- }
- if (!($controller->tmpl instanceof \TYPO3\CMS\Core\TypoScript\TemplateService)) {
- $controller->initTemplate();
- }
- if (!is_array($controller->config)) {
- $controller->getConfigArray();
- }
- if (!($controller->cObj instanceof \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer)) {
- $controller->newCObj();
- }
- if (empty($controller->indexedDocTitle)) {
- \TYPO3\CMS\Frontend\Page\PageGenerator::pagegenInit();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement