Project

General

Profile

Actions

Bug #96464

closed

userFunc in linkhander typolink does not work

Added by Stephan Bauer almost 3 years ago. Updated about 2 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Site Handling, Site Sets & Routing
Target version:
-
Start date:
2022-01-05
Due date:
% Done:

100%

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

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?

Actions

Also available in: Atom PDF