/** * Initializes and runs an extbase controller * * @param string $extensionName Name of extension, in UpperCamelCase * @param string $controller Name of controller, in UpperCamelCase * @param string $action Optional name of action, in lowerCamelCase * @param string $pluginName Optional name of plugin. Default is 'Pi1' * @param array $settings Optional array of settings to use in controller * @param int $pageUid Uid of current page * @param string $vendorName VendorName * @return string output of controller's action */ protected function runExtbaseController($extensionName, $controller, $action = 'index', $pluginName = 'Pi1', $settings = array(), $pageUid = 0, $vendorName = 'PwCommentsTeam') { $GLOBALS['TT'] = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\TimeTracker\\TimeTracker'); $GLOBALS['TSFE'] = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Controller\\TypoScriptFrontendController', $GLOBALS['TYPO3_CONF_VARS'], $pageUid, 0); $GLOBALS['TSFE']->sys_page = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Page\\PageRepository'); $GLOBALS['TSFE']->initTemplate(); $rootline = $GLOBALS['TSFE']->sys_page->getRootLine($pageUid); $GLOBALS['TSFE']->tmpl->start($rootline); $GLOBALS['TSFE']->getConfigArray(); $pluginSettings = $GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_pwcomments.']; $pwCommentsTypoScript = $pluginSettings['settings.']; \TYPO3\CMS\Frontend\Utility\EidUtility::initLanguage('de'); \TYPO3\CMS\Frontend\Utility\EidUtility::initTCA(); \TYPO3\CMS\Frontend\Utility\EidUtility::initExtensionTCA('pw_comments'); if (unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['pw_comments'])) { $settings = array_merge($settings, unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['pw_comments'])); } $settings = array_merge($settings, $pwCommentsTypoScript); $bootstrap = new \TYPO3\CMS\Extbase\Core\Bootstrap(); $bootstrap->cObj = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer'); $extensionTyposcriptSetup = $this->getExtensionTyposcriptSetup(); $localLangArray = array(); if (is_array($pluginSettings['_LOCAL_LANG.'])) { $typoScriptService = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Service\\TypoScriptService'); $localLangArray = $typoScriptService->convertTypoScriptArrayToPlainArray($pluginSettings['_LOCAL_LANG.']); } $configuration = array('pluginName' => $pluginName, 'extensionName' => $extensionName, 'controller' => $controller, 'vendorName' => $vendorName, 'controllerConfiguration' => array($controller), 'action' => $action, 'mvc' => array('requestHandlers' => array('TYPO3\\CMS\\Extbase\\Mvc\\Web\\FrontendRequestHandler' => 'TYPO3\\CMS\\Extbase\\Mvc\\Web\\FrontendRequestHandler')), 'settings' => $settings, 'persistence' => $extensionTyposcriptSetup['plugin']['tx_pwcomments']['persistence'], '_LOCAL_LANG' => $localLangArray); return $bootstrap->run('', $configuration); }