Issue Bug Closed

#96464userFunc in linkhander typolink does not work

Stephan Bauer 01/05/22, 12:50 updated 10/04/22, 14:14

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?

Reviews 2