#99886Linkhandler with UserFunc - no ContentObjectRenderer available
Description
I tried to use a UserFunc for typolink.parameter (like Georg did it in https://docs.typo3.org/p/georgringer/news/main/en-us/Tutorials/BestPractice/Linkhandler/Index.html#dynamic-target-page-from-category-field-single-pid) and after that for typolink itself (like Torben described it in his blog post https://www.derhansen.de/2022/01/typo3-multiple-dynamic-typolink-parameters.html).
Both are using the property
public ContentObjectRenderer $cObj;
that should be filled in any magically way.
In TYPO3 12 the variable is not filled with a ContentObjectRenderer. Of course I could use constructor DI or GeneralUtility::makeInstance to create a new instance of the ContentObjectRenderer, but data would not be filled with the parameters for the typolink. So using data in TypoScript would not work:
parameter.cObject {
userFunc = GeorgRinger\News\Service\LinkHandlerTargetPageService->process
news.data = field:uid
}
or this:
userFunc = DERHANSEN\SfEventMgt\UserFunc\TypoLink->createEventLink
userFunc {
registrationUid = TEXT
registrationUid.data = field:uid
}
I hope I could explain the problem correctly :)
Reviews 0
No change resolves or names this issue in its commit message, and no comment links one.