public function initialize() { $feUserObj = EidUtility::initFeUser(); $pageId = GeneralUtility::_GET('id') ?: 1; /** @var TypoScriptFrontendController $typoScriptFrontendController */ $typoScriptFrontendController = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Controller\\TypoScriptFrontendController', $GLOBALS['TYPO3_CONF_VARS'], $pageId, 0, TRUE); $GLOBALS['TSFE'] = $typoScriptFrontendController; $typoScriptFrontendController->connectToDB(); $typoScriptFrontendController->fe_user = $feUserObj; $typoScriptFrontendController->id = 2653; $typoScriptFrontendController->determineId(); $typoScriptFrontendController->getCompressedTCarray(); $typoScriptFrontendController->initTemplate(); $typoScriptFrontendController->getConfigArray(); $typoScriptFrontendController->includeTCA(); /** @var TypoScriptService $typoScriptService */ $typoScriptService = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Service\\TypoScriptService'); $pluginTyposcript = $typoScriptFrontendController->tmpl->setup['plugin.'][$this->extensionConfiguration['extensionKey'] . '.']; $this->pluginConfiguration = $typoScriptService->convertTypoScriptArrayToPlainArray($pluginTyposcript); // Set configuration to call the plugin $extensionConfiguration['settings'] = $this->pluginConfiguration['settings']; $extensionConfiguration['persistence'] = $this->pluginConfiguration['persistence']; $this->extensionConfiguration = array_merge($extensionConfiguration, $this->extensionConfiguration); $this->bootstrap = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Core\\Bootstrap'); $this->bootstrap->initialize($this->extensionConfiguration); }
/** * Get the typoscript loaded on the current page * * @param $pid integer * @return array */ protected function getTyposcriptSettings($pid) { $typoScript = Tx_PtExtbase_Div::returnTyposcriptSetup($pid, 'module.tx_yag.settings.'); if (!is_array($typoScript) || empty($typoScript)) { $configuration = array('extensionName' => self::EXTENSION_NAME, 'pluginName' => self::PLUGIN_NAME, 'controller' => 'Backend', 'action' => 'settingsNotAvailable', 'switchableControllerActions' => array('Backend' => array('settingsNotAvailable'))); echo $this->bootstrap->run('', $configuration); die; } return GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Service\\TypoScriptService')->convertTypoScriptArrayToPlainArray($typoScript); }
public function initializeConfiguration($configuration) { if (array_key_exists('cid', $_GET)) { $cid = (int) $_GET['cid']; $ttContent = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('*', 'tt_content', 'uid=' . $cid); if (!isset($this->cObj)) { $this->cObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer'); } $this->cObj->data = array_merge($this->cObj->data, $ttContent); } parent::initializeConfiguration($configuration); }
/** * @return mixed */ public function render() { $extensionConfiguration = $this->configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK, $this->arguments['extension'], $this->arguments['plugin']); $configuration = array('extensionName' => $this->arguments['extension'], 'pluginName' => $this->arguments['plugin'], 'controllerName' => $this->arguments['controller'], 'action' => $this->arguments['action']); if ($this->arguments['vendor']) { $configuration['vendorName'] = $this->arguments['vendor']; } if (is_array($this->arguments['arguments'])) { $configuration = \array_merge($this->arguments['arguments'], $configuration); } $configuration = array_merge($extensionConfiguration, $configuration); ksort($configuration); return $this->bootstrap->run('', $configuration); }
/** * Bootstrap Extbase * * @return string */ public function run() { return $this->bootstrap->run('', $this->pluginConfiguration); }
/** * @param \TYPO3\CMS\Extbase\Core\Bootstrap $bootstrap * @param array $configuration * @param array $r * @param \TYPO3\CMS\Extbase\Mvc\Web\Request $request * @param \EssentialDots\ExtbaseHijax\Event\Listener $listener * @param bool $isCacheCallback * @return array * @throws \Tx_EdCache_Exception_PreventActionCaching */ public function handleFrontendRequest($bootstrap, $configuration, $r, $request, $listener, $isCacheCallback = FALSE) { $this->initialize(); $bootstrap->initialize($configuration); $this->setPreventMarkupUpdateOnAjaxLoad(false); /* @var $request \TYPO3\CMS\Extbase\Mvc\Web\Request */ $request = $this->buildRequest($r, $request); $request->setDispatched(false); $namespace = $this->extensionService->getPluginNamespace($request->getControllerExtensionName(), $request->getPluginName()); $_POST[$namespace] = $request->getArguments(); /* @var $response \TYPO3\CMS\Extbase\Mvc\Web\Response */ $response = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Mvc\\Web\\Response'); /* @var $dispatcher \EssentialDots\ExtbaseHijax\MVC\Dispatcher */ $dispatcher = $this->objectManager->get('EssentialDots\\ExtbaseHijax\\MVC\\Dispatcher'); $dispatcher->dispatch($request, $response, $listener); $this->parseHeaders($response); $_POST[$namespace] = array(); $content = $response->getContent(); $this->serviceContent->processIntScripts($content); $this->serviceContent->processAbsRefPrefix($content, $configuration['settings']['absRefPrefix']); $response->setContent($content); // convert HTML to specified format $htmlConverter = $this->objectManager->get('EssentialDots\\ExtbaseHijax\\HTMLConverter\\ConverterFactory'); /* @var $htmlConverter \EssentialDots\ExtbaseHijax\HTMLConverter\ConverterFactory */ $converter = $htmlConverter->getConverter($request->getFormat()); try { $response = $converter->convert($response); } catch (\EssentialDots\ExtbaseHijax\HTMLConverter\FailedConversionException $e) { $this->errorWhileConverting = TRUE; } $result = array('id' => $r['id'], 'format' => $request->getFormat(), 'response' => $response->getContent(), 'preventMarkupUpdate' => $this->getPreventMarkupUpdateOnAjaxLoad(), 'headers' => $response->getHeaders()); if (!$this->errorWhileConverting && $isCacheCallback && !$request->isCached() && $this->cacheRepository) { error_log('Throwing Tx_EdCache_Exception_PreventActionCaching, did you missconfigure cacheable actions in Extbase?'); /* @var $preventActionCaching \Tx_EdCache_Exception_PreventActionCaching */ $preventActionCaching = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('Tx_EdCache_Exception_PreventActionCaching'); $preventActionCaching->setResult($result); throw $preventActionCaching; } return $result; }
/** * Dispatches a request. * @return string */ public function dispatch() { return $this->extbaseBootstap->run('', array('extensionName' => $this->extensionKey, 'pluginName' => 'Ajax')); }