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;