Commit 56354410 authored by Matthias Adrowski's avatar Matthias Adrowski
Browse files

[TASK] Remove BE-Code from ContentReplacerMiddleware

ever since we moved into a middleware, there actually is no reason
to fear beeing called inside a BE Context
parent 1d2e1e9f
......@@ -162,42 +162,21 @@ class ContentReplacerMiddleware implements MiddlewareInterface {
* @throws \TYPO3\CMS\Core\Http\ImmediateResponseException
*/
public function prepareConfiguration(): array {
if (\TYPO3\CMS\Core\Http\ApplicationType::fromRequest($GLOBALS['TYPO3_REQUEST'])->isBackend()) {
/** @var TypoScriptFrontendController $typoScriptFrontendController */
$typoScriptFrontendController = $GLOBALS['TSFE'];
if (!($typoScriptFrontendController instanceof TypoScriptFrontendController)) {
$typoScriptFrontendController = $GLOBALS['TSFE'] = new TypoScriptFrontendController(
$GLOBALS['TYPO3_CONF_VARS'],
0,
0
);
}
if (version_compare(\TYPO3\CMS\Core\Utility\VersionNumberUtility::getCurrentTypo3Version(), '11.0.0', '<')) {
// required in order to generate the menu links later on
$typoScriptFrontendController->settingLanguage();
}
$typoScriptFrontendController->newCObj();
}
$extensionConfiguration = $GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS']['content_replacer'] ?? [];
if (\TYPO3\CMS\Core\Http\ApplicationType::fromRequest($GLOBALS['TYPO3_REQUEST'])->isBackend()) {
$configurationManager = GeneralUtility::makeInstance(BackendConfigurationManager::class);
$extbaseFrameworkConfiguration = $configurationManager->getTypoScriptSetup();
$typoscriptConfiguration = $extbaseFrameworkConfiguration['plugin.']['tx_content_replacer.'];
} else {
if (empty($GLOBALS['TSFE']->tmpl->setup)) {
// we need the TypoScript configuration here, force parsing
GeneralUtility::makeInstance(Context::class)->setAspect(
'typoscript',
GeneralUtility::makeInstance(TypoScriptAspect::class, TRUE)
);
$GLOBALS['TSFE']->tmpl->start($GLOBALS['TSFE']->rootLine);
}
$typoscriptConfiguration = $GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_content_replacer.'];
if (empty($GLOBALS['TSFE']->tmpl->setup)) {
// we need the TypoScript configuration here, force parsing
GeneralUtility::makeInstance(Context::class)->setAspect(
'typoscript',
GeneralUtility::makeInstance(TypoScriptAspect::class, TRUE)
);
$GLOBALS['TSFE']->tmpl->start($GLOBALS['TSFE']->rootLine);
}
$typoscriptConfiguration = $GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_content_replacer.'];
if (is_array($typoscriptConfiguration)) {
foreach ($typoscriptConfiguration as $key => $value) {
$extensionConfiguration[$key] = $value;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment