♻️ 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();
|
$plausible = $this->getPlausibleURL();
|
||||||
|
|
||||||
if (isset($domain) && isset($plausible) && !$this->tsfe->isBackendUserLoggedIn()) {
|
if (isset($domain) && isset($plausible) && !$this->tsfe->isBackendUserLoggedIn()) {
|
||||||
GeneralUtility::makeInstance(AssetCollector::class)
|
$this->assetCollector->addJavaScript(
|
||||||
->addJavaScript(
|
'plausible_analytics',
|
||||||
'plausible_analytics',
|
$plausible . '/js/plausible.js',
|
||||||
$plausible . '/js/plausible.js',
|
[
|
||||||
[
|
'async' => 'async',
|
||||||
'async' => 'async',
|
'defer' => 'defer',
|
||||||
'defer' => 'defer',
|
'data-domain' => $domain
|
||||||
'data-domain' => $domain
|
],
|
||||||
],
|
);
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue