Bug #104527
closedSite Sets Includes are not Included in the request frontend.typoscript attribute
0%
Description
So we are currently upgrading many extensions and the previous way of getting the build typoscript did not work in v13 anymore.
So we had to use the request attributes. While using the request itself in our event listners were mixed expierience. We have noticed that the typoscript config we wanted to include has not shown up...
But first things first. Injecting the Server Request in our construct method of the event listner has resulted in an empty array for the attributes of said request while using $GLOBASL['TYPO3_REQUEST'] has worked just fine.
In this "global request" the typoscript did not include the extensions site sets we had included in the site settings...
so we checked that.
But we have noticed that just copying the same typoscript to the root ts record has worked fine with using the "global request" object...
I cannot provide further inside since I am not that familiar with the building of the typoscript and how site sets are taken into account. But I guess that they are included at a different time?
Here are a few Informations to reproduce the Bug itself:
Make a EventListener that listens to the beforeStyleSheetsRendering or beforeJavaScriptsRendering Event.
Inject the ServerRequest or just use the "Global Request".
Include your Extension Site Set in the Site Settings for the Site you are using.
Notice that only some core Typoscript Configurations are included in the attribute frontend.typoscript
public function __construct(Minifier $minifier, ServerRequestInterface $request)
{
$this->minifier = $minifier;
debug($request->getAttributes());
debug($GLOBALS['TYPO3_REQUEST']->getAttributes());
die;
$frontendTypoScript = $GLOBALS['TYPO3_REQUEST']->getAttribute('frontend.typoscript');
if ($frontendTypoScript instanceof FrontendTypoScript) {
$this->assetCollectorConf = $frontendTypoScript->getSetupArray()['plugin.']['tx_min.']['assetCollector.'] ?? [];
}
}
Files
Updated by Benjamin Franzke about 2 months ago
- Status changed from New to Closed
Hi,
Sorry, a `ServerRequestInterface` must not be injected, as it created a new, empty instance – always.
Currently `$GLOBALS['TYPO3_REQUEST']` needs to be used for APIs that do not provide request-access yet.
Unfortunately it is hard to add this for BeforeJavaScriptsRenderingEvent
as the AssetRenderer
is not request aware yet.
If AssetRender
is made request aware, the event could be extended…