Project

General

Profile

Actions

Bug #99886

closed

Linkhandler with UserFunc - no ContentObjectRenderer available

Added by Alex Kellner almost 2 years ago. Updated about 1 year ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
TypoScript
Target version:
-
Start date:
2023-02-08
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
12
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

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 :)


Related issues 2 (0 open2 closed)

Related to TYPO3 Core - Bug #99887: TypoLink UserFunc in TypoScript seems not to work in 12ClosedGeorg Ringer2023-02-08

Actions
Related to TYPO3 Core - Task #94956: Explicitely set ContentObjectRenderer in USER cObjClosed2021-08-22

Actions
Actions

Also available in: Atom PDF