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 8a9bcdc
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 31 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
max-parallel: 2
matrix:
php-versions: [8.2, 8.3]
typo3-versions: [13.0]
typo3-versions: [13.3]

name: Run tests with PHP ${{ matrix.php-versions }} using TYPO3 ${{ matrix.typo3-versions }}
steps:
Expand Down
36 changes: 8 additions & 28 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 @@ -113,28 +109,12 @@ public function getTypoScriptSettingsFromBackend(int $pid): array
return $this->typoScriptSettings;
}

/**
* Taken from \TYPO3\CMS\Redirects\Service\RedirectService::bootFrontendController
*/
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"
},
"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 8a9bcdc

Please sign in to comment.