[TASK] Work on compatibility for TYPO3 11

This commit is contained in:
Philipp Dieter 2024-11-28 15:19:38 +01:00
parent fb54d608a6
commit 7f3123b61a
5 changed files with 98 additions and 48 deletions

View File

@ -170,22 +170,6 @@ class ActionController extends BaseController
$this->environmentService = $environmentService; $this->environmentService = $environmentService;
} }
/**
* propertyMapper
*
* @var PropertyMapper
*/
protected $propertyMapper;
/**
* @param
*/
public function injectPropertyMapper(
PropertyMapper $propertyMapper
): void {
$this->propertyMapper = $propertyMapper;
}
/** /**
* propertyMappingConfigurationBuilder * propertyMappingConfigurationBuilder
* *
@ -776,11 +760,36 @@ class ActionController extends BaseController
} }
if ($this->pageType) { if ($this->pageType) {
if (is_array($this->responseStatus)) { if (is_array($this->responseStatus)) {
$this->response->setStatus( if (version_compare(TYPO3_branch, '10.0', '>=')) {
array_key_first($this->responseStatus) $response = $this
); ->responseFactory
->createResponse()
->withHeader(
'Content-Type',
'application/json; charset=utf-8'
)
->withStatus(
array_key_first($this->responseStatus),
''
);
} else {
$this->response->setStatus(
array_key_first($this->responseStatus)
);
}
} else { } else {
$this->response->setStatus($this->responseStatus); if (version_compare(TYPO3_branch, '10.0', '>=')) {
$response = $this
->responseFactory
->createResponse()
->withHeader(
'Content-Type',
'application/json; charset=utf-8'
)
->withStatus($this->responseStatus, '');
} else {
$this->response->setStatus($this->responseStatus);
}
} }
if ($this->pageType == $this->ajaxPageType) { if ($this->pageType == $this->ajaxPageType) {
if ($this->environmentService->isEnvironmentInBackendMode()) { if ($this->environmentService->isEnvironmentInBackendMode()) {

View File

@ -41,9 +41,14 @@ class TranslationController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionCont
$languageFactory = GeneralUtility::makeInstance( $languageFactory = GeneralUtility::makeInstance(
LocalizationFactory::class LocalizationFactory::class
); );
$language = $this->request->getAttribute('language');
$locale = $language->getLocale();
//\TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump(
// $locale, '$locale', 3, true, false
//);
$langfileContent = $languageFactory->getParsedData( $langfileContent = $languageFactory->getParsedData(
$langfilePath, $langfilePath,
$GLOBALS['LANG']->lang $locale
); );
$langfileResult = []; $langfileResult = [];
foreach (reset($langfileContent) as $key => $row) { foreach (reset($langfileContent) as $key => $row) {

View File

@ -0,0 +1,14 @@
<?php
defined('TYPO3') || die();
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
'TemplatesAide',
'Dummy',
'dummy'
);
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
'TemplatesAide',
'Translationplugin',
'translation'
);

View File

@ -23,7 +23,6 @@ $EM_CONF[$_EXTKEY] = [
'version' => '0.0.1', 'version' => '0.0.1',
'constraints' => [ 'constraints' => [
'depends' => [ 'depends' => [
'typo3' => '8.7.0-10.99.99',
], ],
'conflicts' => [], 'conflicts' => [],
'suggests' => [], 'suggests' => [],

View File

@ -1,36 +1,59 @@
<?php <?php
defined('TYPO3_MODE') || die('Access denied.'); defined('TYPO3_MODE') || die('Access denied.');
(static function() {
})();
call_user_func( call_user_func(
function() function()
{ {
if (version_compare(TYPO3_branch, '10.0', '>=')) {
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin( \TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
'Cjel.TemplatesAide', 'TemplatesAide',
'Dummy', 'Translationplugin',
[ [
'Dummy' => 'list', \Cjel\TemplatesAide\Controller\TranslationController::class => 'translations'
'Translation' => 'translations' ],
], // non-cacheable actions
// non-cacheable actions [
[ \Cjel\TemplatesAide\Controller\TranslationController::class => ''
'Dummy' => '', ]
'Translation' => '' );
]
);
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin( } else {
'Cjel.TemplatesAide',
'Translationplugin', \TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
[ 'Cjel.TemplatesAide',
'Translation' => 'translations' 'Dummy',
], [
// non-cacheable actions 'Dummy' => 'list',
[ 'Translation' => 'translations'
'Dummy' => '', ],
'Translation' => '' // non-cacheable actions
] [
); 'Dummy' => '',
'Translation' => ''
]
);
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
'Cjel.TemplatesAide',
'Translationplugin',
[
'Translation' => 'translations'
],
// non-cacheable actions
[
'Dummy' => '',
'Translation' => ''
]
);
}
// wizards // wizards
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig( \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig(