Project

General

Profile

Actions

Bug #99886

closed

Linkhandler with UserFunc - no ContentObjectRenderer available

Added by Alex Kellner about 1 year ago. Updated 5 months 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 (1 open1 closed)

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

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

Actions
Actions #1

Updated by Benni Mack 11 months ago

  • Related to Bug #99887: TypoLink UserFunc in TypoScript seems not to work in 12 added
Actions #2

Updated by Benni Mack 11 months ago

  • Status changed from New to Needs Feedback

the class needs to have setContentObjectRenderer() - did you see https://review.typo3.org/c/Packages/TYPO3.CMS/+/70717 ?

Actions #3

Updated by Alex Kellner 11 months ago

Most probably not (it's some time ago and I found a TypoScript only workarround for my issue). If so, someone can close the issue.

Actions #4

Updated by Christian Kuhn 11 months ago

  • Related to Task #94956: Explicitely set ContentObjectRenderer in USER cObj added
Actions #5

Updated by Benni Mack 5 months ago

  • Status changed from Needs Feedback to Closed

will close

Actions

Also available in: Atom PDF