♻️ 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:
Marcel Kapfer 2022-08-10 18:48:26 +02:00
parent 9c43bfc8f5
commit 09f9578d20
Signed by: mmk2410
GPG key ID: CADE6F0C09F21B09

View file

@ -29,8 +29,7 @@ class PageRendererPreProcess
$plausible = $this->getPlausibleURL();
if (isset($domain) && isset($plausible) && !$this->tsfe->isBackendUserLoggedIn()) {
GeneralUtility::makeInstance(AssetCollector::class)
->addJavaScript(
$this->assetCollector->addJavaScript(
'plausible_analytics',
$plausible . '/js/plausible.js',
[