Issue Bug Closed

#92527f:link.typolink does not respect additionalParams

Chris no-lastname-given 10/09/20, 13:04 updated 03/07/25, 04:37

Description

The `additionalParams` parameter in the `typolink` viewhelper is not respected.

Using the example from the [documentation](https://docs.typo3.org/other/typo3/view-helper-reference/10.4/en-us/typo3/fluid/latest/Link/Typolink.html) it returns the following link:

<f:link.typolink parameter="{link}" additionalParams="&u=b"
    target="_blank"
    class="ico-class" title="some title"
    additionalAttributes="{type:'button'}"
    useCacheHash="true"
>
   Linktext
</f:link.typolink>

This translates to

<a href="myfile.doc" title="some title" target="_blank" class="ico-class" type="button">Linktext</a>

The `u=b` is not added to the link.

Debugging the variable `$typoLinkParameter` in the viewhelper (line 130) retuns

file:1414 _blank ico-class "some title" &u=b

Reviews 4

History 1112

  1. Riccardo De Contardi commented and changed status New Needs Feedback 03/30/21, 21:49

    I am looking at https://stackoverflow.com/questions/57558916/fluid-typolink-viewhelper-ignores-additionalparams-attribute)

    and I wonder if the documentation is correct…

    could you try with:

    additionalParams="{name: 'value'}"

    Id est:

    <f:link.typolink parameter="{link}" additionalParams="{u:'b'}" 
        target="_blank" 
        class="ico-class" title="some title" 
        additionalAttributes="{type:'button'}" 
        useCacheHash="true" 
    >
       Linktext
    </f:link.typolink>
  2. Chris no-lastname-given commented 04/01/21, 07:39

    In the meantime, this issue seems to be fixed. With TYPO3 10.4.14 it is all working, like described in the documentation. So the following is right:

    additionalParams="&u=b"

    This issue can be closed.

  3. Chris no-lastname-given commented 04/01/21, 07:46

    One additional note:

    If you link to a file (parameter=“t3://file?uid=8”), the “additionalParams” is not respected, but I guess, this is expected behaviour.

  4. Riccardo De Contardi commented and changed status Needs Feedback Closed 04/01/21, 08:02

    @Chris no-lastname-given thank you for your findings

    Closing the issue.

  5. Johannes Rebhan commented and changed TYPO3 Version 10 13 01/14/25, 15:34

    This came back in V13 LTS

                                <f:link.typolink parameter="{settings.deleteProfileLink}" parts-as="linkMeta" target="_blank" additionalParams="&u=b"><span>{linkMeta.title}</span></f:link.typolink>

    This will not result in a link including &u=b. It ignores additionalParams completely.

  6. Garvin Hicking commented 01/17/25, 14:47

    @W4ldgeist Please open a fresh ticket for this, if this is a regression. It would help if you could specifically mention from which to which release this last worked and when it broke.

    There do not seem to be unit/functional tests for f:link.typolink around using this ‘additionalParams’ attribute, so this can very well have been broken, I agree.

  7. Oliver Hader changed Related to #106063 02/03/25, 10:31

  8. Oliver Hader commented 02/03/25, 10:48

    I’ve created https://review.typo3.org/c/Packages/TYPO3.CMS/+/87993 to verify & document the current behavior. I was not able to reproduce the statement, that f:link.typolink would ignore additionalParams – that does not seem to be the case.

    Since this ticket was closed already, please create a new issue providing more details on how to reproduce the behavior you described. Thanks!

  9. Johannes Rebhan commented 02/04/25, 08:58

    Here a test case that “fails” to add the additionalParams:

        <f:link.typolink parameter="https://www.test.com _blank" parts-as="parts" additionalParams="&u=b">{parts.title}</f:link.typolink>

    Reason why that is not expected/robust behaviour? If you let an editor add a base URL, base link for some external resources, but you need to modify the calling URL based on other configuration in that content element, then you can’t add them directly into the url, because the string is coming from a Typolink field, which also adds title, css class, target in the link text. That’s why it would be helpful, useful, if the setting would also apply to pure external text links.

  10. Gerrit Code Review pushed patch set 1 for main to change 88014 status Closed Under Review 02/04/25, 12:24

  11. Garvin Hicking commented 02/04/25, 15:50

    I had to abandon the patch approach.

    additionalParams has been implemented to NOT apply to external links since at least TYPO3 6.2 – such a behavioral change might lead to leaking sensitive internal URI arguments:

    https://docs.typo3.org/m/typo3/reference-typoscript/6.2/en-us/Functions/Typolink/Index.html

    The LinkBuilder cannot easily be enhanced with a new attribute like “externalAdditionalParams” (because of the various input formats).

    I think the best route to go for an implementation like this is to add a new PSR-14 event like “ModifyPageLinkConfigurationEvent” also to the ExternalUrlLinkBuilder, so that additional parameters can be added on PHP-side, without affecting existing VH/TS implementations.

  12. Garvin Hicking changed status Under Review Closed 03/07/25, 04:37