Skip to content

Commit

Permalink
Merge pull request #62 from JAK0TA/disable-tsfe-for-13
Browse files Browse the repository at this point in the history
feat: disable tsfe init for typo3 13
  • Loading branch information
KrohnMi authored Jan 22, 2025
2 parents d4154b6 + 98bafcf commit c1b8c95
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Classes/Middleware/MiddlewareActionAbstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use TYPO3\CMS\Core\Context\Context;
use TYPO3\CMS\Core\Context\LanguageAspect;
use TYPO3\CMS\Core\Context\UserAspect;
use TYPO3\CMS\Core\Information\Typo3Version;
use TYPO3\CMS\Core\Localization\LanguageService;
use TYPO3\CMS\Core\Localization\LanguageServiceFactory;
use TYPO3\CMS\Core\Routing\PageArguments;
Expand Down Expand Up @@ -64,7 +65,7 @@ public function __construct(ServerRequestInterface $request, $pathParams) {

$contentType = $this->request->getHeaderLine('Content-Type');
if (false !== stripos($contentType, 'application/json')) {
/** @var null|array<string|int, mixed> $parsedBody */
/** @var null|array<int|string, mixed> $parsedBody */
$parsedBody = json_decode($this->request->getBody()->getContents(), true);
$this->requestBody = null !== $parsedBody ? $parsedBody : [];
} else {
Expand Down Expand Up @@ -92,7 +93,10 @@ public function __construct(ServerRequestInterface $request, $pathParams) {
if (null !== $this->siteLanguage) {
$this->languageService = $this->languageServiceFactory->createFromSiteLanguage($this->siteLanguage);
$GLOBALS['LANG'] = $this->languageService;
}

$typo3Version = GeneralUtility::makeInstance(Typo3Version::class);
if (version_compare($typo3Version->getVersion(), '13.4.0') < 0) {
if (!isset($GLOBALS['TSFE'])) {
$parsedBody = (array) $this->request->getParsedBody();

Expand All @@ -109,6 +113,7 @@ public function __construct(ServerRequestInterface $request, $pathParams) {
),
$frontendUser,
);

$GLOBALS['TSFE']->tmpl = GeneralUtility::makeInstance(TemplateService::class);
$GLOBALS['TSFE']->determineId($this->request);
$GLOBALS['TSFE']->getConfigArray();
Expand Down

0 comments on commit c1b8c95

Please sign in to comment.