Bug #96464
closeduserFunc in linkhander typolink does not work
100%
Description
I'm trying to use a userFunc in a linkhandler configuration:
config.recordLinks { tx_beerdb_domain_model_affiliate { typolink { userFunc = BU\Beerdb\Hooks\AffiliateTypolink->affiliate } } }
The userFunc never gets call.
I found out without a
parameter
the link generation never comes to the part where the userFunc will be executed.In sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php line 5140 because of an empty
$linkParamter
the function returns to early.if (!$linkParameter) { return $this->resolveAnchorLink($linkText, $conf ?? []); }
With a litte change
if (!$linkParameter && !$conf['userFunc']) { return $this->resolveAnchorLink($linkText, $conf ?? []); }
the userFunc gets call in line 5275 but dynamic values like
userFunc { uid = TEXT uid.data = FIELD:uid }
are not evaluated.
Is this a bug or a configuration problem?
Updated by Benni Mack almost 3 years ago
Is this a bug or a configuration problem?
It's a bug, I will fix it.
Updated by Gerrit Code Review almost 3 years ago
- Status changed from New to Under Review
Patch set 1 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/72894
Updated by Gerrit Code Review almost 3 years ago
Patch set 2 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/72894
Updated by Gerrit Code Review almost 3 years ago
Patch set 1 for branch 11.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/72916
Updated by Benni Mack almost 3 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset b72d3fd5cd5d459d65724ca4cc0a323c8e9103fa.
Updated by Gerrit Code Review almost 3 years ago
- Status changed from Resolved to Under Review
Patch set 2 for branch 11.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/72916
Updated by Stephan Bauer almost 3 years ago
I added this patch to V 10.4 but still it does not work.
Now only the link text will be returned in line 4632 with return $e->getLinkText();
If I jump over this to reach the call for the userFunc the parameter $content
is nearly empty:
array(5 items) aTagParams => '' (0 chars) url => '' (0 chars) TYPE => NULL targetParams => '' (0 chars) TAG => '<a >' (4 chars)
and
$configuration
is not resolvedarray(3 items) uid => 'TEXT' (4 chars) uid. => array(1 item) data => 'FIELD:uid' (9 chars) relAttribute => 'rel="sponsored" class="beer-affiliate-link"' (43 chars)
Updated by Benni Mack almost 3 years ago
- Status changed from Under Review to Resolved
Applied in changeset 6bda1ea5e000bc286df1570f048be7bd7450b681.