Skip to content

Commit

Permalink
[FIX] Adjust TS generation for TYPO3 13.3
Browse files Browse the repository at this point in the history
  • Loading branch information
fnagel committed Sep 19, 2024
1 parent 699f39c commit 17c26a3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 27 deletions.
33 changes: 8 additions & 25 deletions Classes/Service/SettingsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,11 @@
*/

use Psr\Http\Message\ServerRequestInterface;
use TYPO3\CMS\Core\Context\Context;
use TYPO3\CMS\Core\Routing\PageArguments;
use TYPO3\CMS\Core\Site\SiteFinder;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Configuration\BackendConfigurationManager;
use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface;
use TYPO3\CMS\Extbase\Configuration\Exception;
use TYPO3\CMS\Extbase\Reflection\ObjectAccess;
use TYPO3\CMS\Core\TypoScript\TypoScriptService;
use TYPO3\CMS\Frontend\Authentication\FrontendUserAuthentication;
use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;

/**
* Provide a way to get the configuration just everywhere.
Expand All @@ -46,8 +41,9 @@ class SettingsService
* SettingsService constructor.
*/
public function __construct(
protected ConfigurationManagerInterface $configurationManager,
protected TypoScriptService $typoScriptService
protected readonly ConfigurationManagerInterface $configurationManager,
protected readonly TypoScriptService $typoScriptService,
protected readonly BackendConfigurationManager $backendConfigurationManager,
) {
}

Expand Down Expand Up @@ -118,23 +114,10 @@ public function getTypoScriptSettingsFromBackend(int $pid): array
*/
protected function generateTypoScript(int $pid, ServerRequestInterface $request): array
{
$siteFinder = GeneralUtility::makeInstance(SiteFinder::class);
$site = $siteFinder->getSiteByPageId($pid);

$controller = GeneralUtility::makeInstance(
TypoScriptFrontendController::class,
GeneralUtility::makeInstance(Context::class),
$site,
$site->getDefaultLanguage(),
new PageArguments($site->getRootPageId(), '0', []),
GeneralUtility::makeInstance(FrontendUserAuthentication::class)
);

// @extensionScannerIgnoreLine
$controller->id = $pid;
$controller->determineId($request);

return $controller->getFromCache($request)->getAttribute('frontend.typoscript')->getSetupArray();
// @todo Seems this does not consider disabled template records, unsure why
return $this->backendConfigurationManager->getTypoScriptSetup($request->withQueryParams([
'id' => $pid,
]));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
],
"require": {
"php": "^8.2",
"typo3/cms-core": "^13"
"typo3/cms-core": ">=13.3.0,<=11.4.99"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.12",
Expand Down
2 changes: 1 addition & 1 deletion ext_emconf.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
'constraints' => [
'depends' => [
'php' => '8.2.0-8.3.99',
'typo3' => '13.0.0-13.4.99',
'typo3' => '13.3.0-13.4.99',
],
'suggests' => [
'filemetadata' => '',
Expand Down

0 comments on commit 17c26a3

Please sign in to comment.