Bug #101897
open
typolink userfunc changes linktext to a pipe
Added by Mike Street 9 months ago.
Updated 9 months ago.
Category:
Content Rendering
Description
We have some code which uses the `userFunc` functionality of `typolink` - since upgrading to v11, the `$linkText` variable gets set to a pipe `|` (this worked in v10)
I have narrowed this down to the `lastTypoLinkResult->withAttributes()` method call within the `ContentObjectRenderer.php` file (link to line)
It seems this line replaces the whole of the `lastTypoLinkResult` but sets the title back to the default of `|`.
I have managed to resolve this locally by adding `->withLinkText($linkText)` to the end of this line - which passes the existing link text through to the new `LinkResult` class.
This can be varified by outputing `$this->lastTypoLinkResult->getLinkText()` before and after the `if` statement: https://github.com/TYPO3/typo3/blob/11.5/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php#L4956-L4962
We have some code which uses the userFunc
functionality of typolink
- since upgrading to v11, the $linkText
variable gets set to a pipe |
(this worked in v10)
I have narrowed this down to the lastTypoLinkResult->withAttributes()
method call within the ContentObjectRenderer.php
file (link to line)
It seems this line replaces the whole of the lastTypoLinkResult
but sets the title back to the default of |
.
I have managed to resolve this locally by adding ->withLinkText($linkText)
to the end of this line - which passes the existing link text through to the new LinkResult
class.
This can be verified by outputting $this->lastTypoLinkResult->getLinkText()
before and after the if
statement: https://github.com/TYPO3/typo3/blob/11.5/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php#L4956-L4962.
I'm happy to submit a patch/fix for this if desired)
(Edit to add correct syntax highlighting & fix some typos)
please go ahead and submit a patch to gerrit, thanks!
- Status changed from New to Under Review
Also available in: Atom
PDF