Bug #99887
openTypoLink UserFunc in TypoScript seems not to work in 12
0%
Description
I just tried to use a UserFunc for typolink as part of a linkhandler configuration (like Torben shows it in his blog post https://www.derhansen.de/2022/01/typo3-multiple-dynamic-typolink-parameters.html).
The UserFunc is called correctly. But returning a string with a beginning A-tag does not render the link:
class TypoLink { public function createEventLink(array $content, array $config): string { return '<a href="/">'; } }
Updated by Benni Mack about 1 year ago
- Status changed from New to Needs Feedback
Hi Alex,
can you attach the TypoScript you're using?
Updated by Alex Kellner about 1 year ago
Sorry Benni,
meanwhile I switched to a TypoScript-Only solution in LUX to get linkhandler to work. Also "Local History" in PhpStorm is empty for the file.
With this issue I opened a second one with #99886 - maybe that helps you (even if the issue is a bit different).
Alex
Update I think it was exactly like Torben shows it in his blogpost like:
config { recordLinks { registration { typolink { parameter = 1 userFunc = DERHANSEN\SfEventMgt\UserFunc\TypoLink->createEventLink userFunc { eventUid = TEXT eventUid.data = field:event registrationUid = TEXT registrationUid.data = field:uid } } } } }
Updated by Benni Mack about 1 year ago
- Related to Bug #99886: Linkhandler with UserFunc - no ContentObjectRenderer available added
Updated by cosmoblonde GmbH 10 days ago
Hi,
we are experiencing the same issue for a project we are upgrading from a working LTS 11 version to 12.
It seems that the userfunc return value is not used in any way for the typolink generation.
We did double check and can confirm that our userfunc is returning a full (and valid) a-tag.
(We even tried with only returning an opening a-tag as suggested by some source)
If we comment out our userFunc line in our TS, a link is generated to the parameter pid given in our typoscript.
Therefore we assume userFunc is not working with typolink in v12.
Are there any news on this issue? Or can you at least confirm, it is an open issue?
Thank you!
Ulrike
Updated by Benni Mack 10 days ago
Hey Ulrike,
does your userFunc return a string or a LinkResult object?
Updated by cosmoblonde GmbH 5 days ago
Hey Benni,
currently we are returning a string but if it is required we can switch to a LinkResult object.