♻️ Use already existing asset collector
For some reason the AssetCollector instance created (or passed) in the PageRendererPreProcess constructor was not used, but instead a new instance was made as part of the addLibrary function. This commit refactors PageRendererPreProcess::addLibrary to use the already created AssetCollector.
This commit is contained in:
parent
9c43bfc8f5
commit
09f9578d20
1 changed files with 9 additions and 10 deletions
|
@ -29,16 +29,15 @@ class PageRendererPreProcess
|
|||
$plausible = $this->getPlausibleURL();
|
||||
|
||||
if (isset($domain) && isset($plausible) && !$this->tsfe->isBackendUserLoggedIn()) {
|
||||
GeneralUtility::makeInstance(AssetCollector::class)
|
||||
->addJavaScript(
|
||||
'plausible_analytics',
|
||||
$plausible . '/js/plausible.js',
|
||||
[
|
||||
'async' => 'async',
|
||||
'defer' => 'defer',
|
||||
'data-domain' => $domain
|
||||
],
|
||||
);
|
||||
$this->assetCollector->addJavaScript(
|
||||
'plausible_analytics',
|
||||
$plausible . '/js/plausible.js',
|
||||
[
|
||||
'async' => 'async',
|
||||
'defer' => 'defer',
|
||||
'data-domain' => $domain
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue