From 6637da542bf3b72836ccdb8ffc773d42c29e0bd1 Mon Sep 17 00:00:00 2001 From: Devid Messner Date: Tue, 5 Mar 2024 14:09:19 +0100 Subject: [PATCH] fix(AfterLinkIsGenereatedEvent): Loads TypScriptFrontendController at the beginning The TypoScriptFrontendController is already required in the function isEnabled. It should therefore be loaded beforehand. resolve #49 --- Classes/TypoLink/LinkModifier.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Classes/TypoLink/LinkModifier.php b/Classes/TypoLink/LinkModifier.php index 0826c2b..a1ebc12 100644 --- a/Classes/TypoLink/LinkModifier.php +++ b/Classes/TypoLink/LinkModifier.php @@ -40,12 +40,13 @@ class LinkModifier public function __invoke(AfterLinkIsGeneratedEvent $event): void { + $this->contentObjectRenderer = $event->getContentObjectRenderer(); + $this->frontendController = $this->contentObjectRenderer->getTypoScriptFrontendController(); + if ($this->isEnabled($event)) { $url = $event->getLinkResult()->getUrl(); $context = $event->getLinkResult()->getType(); $configuration = $event->getLinkResult()->getLinkConfiguration(); - $this->contentObjectRenderer = $event->getContentObjectRenderer(); - $this->frontendController = $this->contentObjectRenderer->getTypoScriptFrontendController(); // Strip the absRefPrefix from the URLs. $urlPrefix = (string)$this->getTypoScriptFrontendController()->absRefPrefix;