Project

General

Profile

Actions

Bug #99887

open

TypoLink UserFunc in TypoScript seems not to work in 12

Added by Alex Kellner about 1 year ago. Updated 5 days ago.

Status:
Needs Feedback
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 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="/">';
    }
}


Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Bug #99886: Linkhandler with UserFunc - no ContentObjectRenderer availableClosed2023-02-08

Actions
Actions #1

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?

Actions #2

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
                }
            }
        }
    }
}
Actions #3

Updated by Benni Mack about 1 year ago

  • Related to Bug #99886: Linkhandler with UserFunc - no ContentObjectRenderer available added
Actions #4

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

Actions #5

Updated by Benni Mack 10 days ago

Hey Ulrike,

does your userFunc return a string or a LinkResult object?

Actions #6

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.

Actions

Also available in: Atom PDF