Task #97638
closedUse local TypoScriptFrontendController instead of $GLOBALS['TSFE'] in ContentObjects
100%
Description
The ContentObjectRenderer
already offers the possibility to use a local version of the TypoScriptFrontendController
, if this is not available the global version is used.
So the base is there to use different initialized frontend environments without risking conflicts, but unfortunately most ContentObjects still access the global version $GLOBALS['TSFE'] directly, e.g. the ImageResourceContentObject
:
public function render($conf = [])
{
$GLOBALS['TSFE']->lastImgResourceInfo = $this->cObj->getImgResource($conf['file'] ?? '', $conf['file.'] ?? []);
if ($GLOBALS['TSFE']->lastImgResourceInfo) {
$imageResource = $GLOBALS['TSFE']->lastImgResourceInfo[3];
$theValue = isset($conf['stdWrap.']) ? $this->cObj->stdWrap($imageResource, $conf['stdWrap.']) : $imageResource;
} else {
$theValue = '';
}
return $theValue;
}
From my point of view it makes sense in general to rely less on global objects, but with the indexing of EXT:solr there are also concrete use cases in which consistent access to the local objects is helpful.
Since the ContentObjectRenderer itself falls back on the global object of the TypoScriptFrontendController
, an adaption of the ContentObjects should be uncomplicated and should not result in a breaking change:
/**
* @return TypoScriptFrontendController|null
* @internal this is set to public so extensions such as EXT:solr can use the method in tests.
*/
public function getTypoScriptFrontendController()
{
return $this->typoScriptFrontendController ?: $GLOBALS['TSFE'] ?? null;
}
(TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer)
Updated by Markus Friedrich over 2 years ago
We will try to provide a PR in the next few days, would be nice if the changes could be merged into one of next versions of TYPO3 11.
Updated by Gerrit Code Review over 2 years ago
- Status changed from New to Under Review
Patch set 1 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/74681
Updated by Gerrit Code Review over 2 years ago
Patch set 1 for branch 11.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/74682
Updated by Gerrit Code Review over 2 years ago
Patch set 2 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/74681
Updated by Gerrit Code Review over 2 years ago
Patch set 3 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/74681
Updated by Gerrit Code Review over 2 years ago
Patch set 4 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/74681
Updated by Gerrit Code Review over 2 years ago
Patch set 5 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/74681
Updated by Gerrit Code Review over 2 years ago
Patch set 6 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/74681
Updated by Gerrit Code Review over 2 years ago
Patch set 7 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/74681
Updated by Gerrit Code Review over 2 years ago
Patch set 8 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/74681
Updated by Gerrit Code Review over 2 years ago
Patch set 9 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/74681
Updated by Gerrit Code Review over 2 years ago
Patch set 10 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/74681
Updated by Gerrit Code Review over 2 years ago
Patch set 11 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/74681
Updated by Gerrit Code Review over 2 years ago
Patch set 12 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/74681
Updated by Gerrit Code Review over 2 years ago
Patch set 13 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/74681
Updated by Gerrit Code Review over 2 years ago
Patch set 14 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/74681
Updated by Gerrit Code Review over 2 years ago
Patch set 15 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/74681
Updated by Gerrit Code Review over 2 years ago
Patch set 16 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/74681
Updated by Markus Friedrich over 2 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 8020024e46f00472853dac4836cc1677b31a4802.
Updated by Gerrit Code Review over 2 years ago
- Status changed from Resolved to Under Review
Patch set 1 for branch 11.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/75073
Updated by Gerrit Code Review over 2 years ago
Patch set 2 for branch 11.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/75073
Updated by Gerrit Code Review over 2 years ago
Patch set 3 for branch 11.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/75073
Updated by Gerrit Code Review over 2 years ago
Patch set 4 for branch 11.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/75073
Updated by Gerrit Code Review over 2 years ago
Patch set 5 for branch 11.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/75073
Updated by Gerrit Code Review over 2 years ago
Patch set 6 for branch 11.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/75073
Updated by Gerrit Code Review over 2 years ago
Patch set 7 for branch 11.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/75073
Updated by Gerrit Code Review over 2 years ago
Patch set 8 for branch 11.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/75073
Updated by Gerrit Code Review over 2 years ago
Patch set 9 for branch 11.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/75073
Updated by Gerrit Code Review over 2 years ago
Patch set 10 for branch 11.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/75073
Updated by Gerrit Code Review over 2 years ago
Patch set 11 for branch 11.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/75073
Updated by Gerrit Code Review over 2 years ago
Patch set 12 for branch 11.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/75073
Updated by Gerrit Code Review over 2 years ago
Patch set 13 for branch 11.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/75073
Updated by Gerrit Code Review over 2 years ago
Patch set 14 for branch 11.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/75073
Updated by Gerrit Code Review over 2 years ago
Patch set 15 for branch 11.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/75073
Updated by Markus Friedrich over 2 years ago
- Status changed from Under Review to Resolved
Applied in changeset d8693afc4cd9e6b65a063f16770441b8068fe191.
Updated by Andreas Kießling about 2 years ago
- Related to Bug #98622: Pass down local TypoScriptFrontendController when instantiating a new ContentObjectRenderer from RECORDS and CONTENT added