[!!!][FEATURE] Avoid TSFE->config['config']
Frontend TypoScript has two special details, next to 'configuration' ("constants") and 'setup'. First, there is the determined "PAGE" object that depends on type / typeNum. It allows to render multiple different variants of a pages content. Historically, this has often been a "print" view, nowadays, this is usually a "json" variant, or some XML for sitemaps. A frontend is not rendered without a proper PAGE object. The FE rendering chain determines the given 'type' and maps it to a configured PAGE with this 'typeNum', defaulting to zero '0'. The patch models the determined PAGE object to the Request attribute 'FrontendTypoScript' now, which is used by FE RequestHandler to manage rendering of this PAGE type. Second special thing is 'config' TypoScript as top-level 'config' settings. Those can be overridden by the specific PAGE object (often 'page.config'). A typical use case is 'json.config.disableAllHeaderCode = 1'. This "merged" 'config' array has been available as TSFE->config['config'] before. The patch makes the merged config available in the 'FrontendTypoScript' object as well, available in the Request object as 'frontend.typoscript' attribute. The patch adapts all usages of TSFE->config['config'] to the attribute. There is a special quirk with 'config': This part of TypoScript 'setup' is so important, that it needs to be available in 'fully cached page' scenarios as well, to for instance decide if a content-length header should be added to the response. This has been the reason 'config' has been cached along with page cache content in 'page' cache before. The patch changes this and adds dedicated cache entries for 'merged config' in the (file based) 'typoscript' cache. This reduces page cache size a bit and allows re-using these 'config' cache accross different pages when they are identical, which is determined by the cache identifiers. All these changes are logical follow-ups to the TypoScript parser that has been implemented with v12. They pave the way to extract TypoScript calculation from TypoScriptFrontendController with upcoming patches. Next to this refactoring, the existing hooks in this area had to fall, especially to get rid of their dependency to "pObj" TypoScriptFrontendController. They are mostly substituted by new events, details are documented with the .rst files and class comments. The patch reduces usages of $GLOBALS['TSFE'] and usages of TypoScriptFrontendController in general. $GLOBALS['TSFE']->config['config'] is still available as b/w compat layer (a dedicated deprecation will follow), but core usages have been removed. This became a bit complicated with TimeTrackerInitialization and WorkspacePreview middlewares: Both are run before the final TypoScript 'config' is determined, so they do not have that attribute attached to their incoming Request. But they still need to know TS 'config' details to decide on details *after* calling lower handle() middlewares. They by now accessed $GLOBALS['TSFE'], which is (still) set by a lower middleware. To avoid this indirect state usage, these middlewares now register an event listener that is dispatched after TypoScript 'config' has been determined, and set local state to know if they should add additional Response data. Resolves: #102932 Releases: main Change-Id: I8282f7a93fe9594e78865db63a3e656cc4d5f8da Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/82522 Tested-by:Stefan Bürk <stefan@buerk.tech> Tested-by:
Benni Mack <benni@typo3.org> Reviewed-by:
Benni Mack <benni@typo3.org> Reviewed-by:
Stefan Bürk <stefan@buerk.tech> Tested-by:
Christian Kuhn <lolli@schwarzbu.ch> Tested-by:
core-ci <typo3@b13.com> Reviewed-by:
Christian Kuhn <lolli@schwarzbu.ch>
Showing
- typo3/sysext/adminpanel/Classes/Middleware/AdminPanelDataPersister.php 3 additions, 5 deletions...adminpanel/Classes/Middleware/AdminPanelDataPersister.php
- typo3/sysext/adminpanel/Classes/Middleware/AdminPanelRenderer.php 3 additions, 5 deletions...sext/adminpanel/Classes/Middleware/AdminPanelRenderer.php
- typo3/sysext/adminpanel/Classes/Utility/StateUtility.php 0 additions, 5 deletionstypo3/sysext/adminpanel/Classes/Utility/StateUtility.php
- typo3/sysext/adminpanel/Tests/Unit/Utility/StateUtilityTest.php 0 additions, 39 deletions...sysext/adminpanel/Tests/Unit/Utility/StateUtilityTest.php
- typo3/sysext/core/Classes/Page/DefaultJavaScriptAssetTrait.php 10 additions, 12 deletions.../sysext/core/Classes/Page/DefaultJavaScriptAssetTrait.php
- typo3/sysext/core/Classes/PageTitle/PageTitleProviderManager.php 1 addition, 2 deletions...ysext/core/Classes/PageTitle/PageTitleProviderManager.php
- typo3/sysext/core/Classes/TypoScript/AST/Merger/SetupConfigMerger.php 66 additions, 0 deletions.../core/Classes/TypoScript/AST/Merger/SetupConfigMerger.php
- typo3/sysext/core/Classes/TypoScript/FrontendTypoScript.php 81 additions, 0 deletionstypo3/sysext/core/Classes/TypoScript/FrontendTypoScript.php
- typo3/sysext/core/Documentation/Changelog/13.0/Breaking-102932-RemovedTypoScriptFrontendControllerHooks.rst 47 additions, 0 deletions...aking-102932-RemovedTypoScriptFrontendControllerHooks.rst
- typo3/sysext/core/Documentation/Changelog/13.0/Feature-102932-NewTypoScriptRelatedFrontendEvents.rst 35 additions, 0 deletions...3.0/Feature-102932-NewTypoScriptRelatedFrontendEvents.rst
- typo3/sysext/core/Tests/Unit/TypoScript/AST/Merger/SetupConfigMergerTest.php 299 additions, 0 deletions...ests/Unit/TypoScript/AST/Merger/SetupConfigMergerTest.php
- typo3/sysext/fluid/Tests/Functional/ViewHelpers/FormViewHelperTest.php 1 addition, 0 deletions...fluid/Tests/Functional/ViewHelpers/FormViewHelperTest.php
- typo3/sysext/fluid/Tests/Functional/ViewHelpers/Link/ActionViewHelperTest.php 5 additions, 19 deletions...ests/Functional/ViewHelpers/Link/ActionViewHelperTest.php
- typo3/sysext/fluid/Tests/Functional/ViewHelpers/Link/PageViewHelperTest.php 4 additions, 11 deletions.../Tests/Functional/ViewHelpers/Link/PageViewHelperTest.php
- typo3/sysext/fluid/Tests/Functional/ViewHelpers/Uri/ActionViewHelperTest.php 1 addition, 0 deletions...Tests/Functional/ViewHelpers/Uri/ActionViewHelperTest.php
- typo3/sysext/fluid/Tests/Functional/ViewHelpers/Uri/PageViewHelperTest.php 0 additions, 3 deletions...d/Tests/Functional/ViewHelpers/Uri/PageViewHelperTest.php
- typo3/sysext/form/Classes/Domain/Finishers/AbstractFinisher.php 1 addition, 4 deletions...sysext/form/Classes/Domain/Finishers/AbstractFinisher.php
- typo3/sysext/form/Classes/Mvc/Configuration/TypoScriptService.php 1 addition, 4 deletions...sext/form/Classes/Mvc/Configuration/TypoScriptService.php
- typo3/sysext/form/Tests/Unit/Mvc/Configuration/TypoScriptServiceTest.php 3 additions, 9 deletions...rm/Tests/Unit/Mvc/Configuration/TypoScriptServiceTest.php
- typo3/sysext/frontend/Classes/ContentObject/AbstractContentObject.php 2 additions, 0 deletions.../frontend/Classes/ContentObject/AbstractContentObject.php
Loading
Please register or sign in to comment