Fluid Typolink ViewHelper ignores additionalParams-attribute - typo3

I want to create a link to an external page with parameters via the f:link.typolink-ViewHelper. The ViewHelper creates the link but without my parameters. I've used an example from the TYPO3 documentation (https://docs.typo3.org/other/typo3/view-helper-reference/9.5/en-us/typo3/fluid/latest/Link/Typolink.html). I'm using TYPO3 9.5. Do I need some further configuration?
<f:link.typolink parameter="www.test-link.de" additionalParams="&u=b">
Linktext
</f:link.typolink>

The correct way to write this would be:
additionalParams="{name: 'value'}"
You can even combine multiple parameters like this:
additionalParams="{name: 'value', anotherName: 'anotherValue'}"

It can work without additionalParams
<f:link.typolink parameter="www.test-link.de?u=b" >
Linktext
</f:link.typolink>
FYI, additionalParams was not working of me as well. So I did the above
Update:
There is documentation error at https://docs.typo3.org/other/typo3/view-helper-reference/10.4/en-us/typo3/fluid/latest/Link/Typolink.html
Way to do it is as suggested by #Scopestyle

Related

Remove the word 'Page' from indexed_search pagination?

The indexed_search pagination outputs links like "Page 1, Page 2, Page 3"
Is there any way to edit it to remove the word 'Page' so the output is just the numbers?
<is:pageBrowsingResults numberOfResults="{result.count}" currentPage="{searchParams.pointer}" resultsPerPage="{searchParams.numberOfResults}" />
I just looked into the code and saw that the page label is fetched from the locallang with index displayResults.page.
With plugin.tx_indexedsearch._LOCAL_LANG.en.displayResults.page = and without a string behind the = it should work.
The en is for the language key, you need to set it for every language.
The documentation you can find here:
https://docs.typo3.org/m/typo3/reference-typoscript/master/en-us/TopLevelObjects/Plugin.html#local-lang-lang-key-label-key
From Typo3 10 onwards we have no pagination HTML template, instead Typo3 has provided ViewHelper for PageBrowser.
So, We can extend that viewhelper in our Template provider extension and edit as per our needs.

Viewhelper f:link.typolink in TYPO3 9.5 LTS

The viewhelper
<f:link.typolink parameter="{link}">
works only with strings like '19 _blank - "testtitle with whitespace"'
But since 8.7 LTS typolinks are formatted like "t3://page?uid=4284". This works:
<f:link.typolink parameter="4284">
this dont:
<f:link.typolink parameter="t3://page?uid=4284">
but the typolink widgets works the new way - there is no possiblity anymore to get the old syntax.
Any ideas how to deal with a modern typolink in a viewhelper?
Thanks!
I have tested <f:link.typolink parameter="t3://page?uid=23">test</f:link.typolink> on TYPO3 9.5.3. It works for me, as long the uid refers to a valid page. When the uid is not valid, only the text is renderd without any link.
The new format is also documented as an example in
TyposcriptReference: Typolink.
It should work.
Valid uid:
<f:link.typolink parameter="t3://page?uid=23">test</f:link.typolink>
Result:
test
Wrong uid:
<f:link.typolink parameter="t3://page?uid=9999999">test</f:link.typolink>
Result:
test
Alternative with <f:format.html>:
<f:format.html>my link</f:format.html>
Result:
my link

Wrap H1-H6 Tags with Typo3 ParseFunc depending on the class set in RTE

I want to add inline-svgs to my h1 to h6 Tags depending on the class set in the RTE.
Example:
RTE:
<h1 class="icon--clock">Header</h1>
Output:
<h1 class="icon--clock"><svg>...</svg>Header</h1>
I've done something similar with links before, using the parseFunc Config. A method like this: https://wiki.typo3.org/External_links
Is there any way to access and split the tag and class like the link parameters through TypoScript?
I also tried using a userFunc
lib.parseFunc.userFunc = ...\MyClass->MyUserFunc
but in Params I only get the tag content, not the tag or the classes that have been set themselves.
I'm using Typo8 with the ckeditor, but I don't think that makes a difference.
Can I even do this?
How do I do this?
I know that I can alternatively add different header layouts and use the tt_content header field, because it's easier to manipulate the template there. But I'd love to know if there is a way to this in the RTE.
I think you could do it in typoscript, but that would be very complicated as you need to analyze the attributes of the Hn-tags.
A simpler method which came to mind would be: use CSS and ::before. So you can use a selector to the class to insert the matching SVG.
This also can be done with javascript but as CSS can do it it would be more efficient to use CSS.

Link to file in Fluid – how to specify storage?

As far as I know, there's no such thing as an f:link.file or v:link.file viewhelper.
There used to be a solution using file.originalResource.publicUrl as the value to point the link to, as in
<f:link.page pageUid="{file.originalResource.publicUrl}" target="_blank">
Am I right that this is no longer necessary? I got this (using ext:mask):
<f:link.page pageUid="{file.identifier}" target="_blank">
returning the same value, while originalResource.publicUrl would not even show up in f:debug.
BUT in file.identifier the storage path, e.g. fileadmin, is not present. How do I add it to the viewhelper?
Or, what is the currently recommended solution for a link to a file in TYPO3 7.6?
Just use {file.name}. When absolute URL or some special configuration is needed use <f:link.typolink parameter="{file.publicUrl}">{file.name}</f:link.typolink>.
TYPO3 11 introduced a new ViewHelper for this
<f:link.file file="{file}" target="_blank">Download</f:link.file>
https://docs.typo3.org/other/typo3/view-helper-reference/11.5/en-us/typo3/fluid/latest/Link/File.html
For me, #minifranske’s solution worked only as a hint: I needed to use {file.originalResource.publicUrl} instead:
<f:link.typolink parameter="{file.originalResource.publicUrl}">{file.originalResource.title}</f:link.typolink>
also available:
{file.originalResource.name}
{file.originalResource.description}
{file.originalResource.alternative}
Nevertheless, if anybody knows a proper core solution which resembles that of the Rich Text Editor, I’d be happy to hear about it:
file link
page link
<f:uri.image image="{imageObject}" /> produces the path + filename for your FAL object.

tx_news Paginate with dynamic variables

I have created a custom template for paginations. But I want to display a count of all news articels and so I'm looking for a solution to pass a variables to the pagination. I don't want to build a custom viewhelper, I want to stick with the original PagionationViewhelper.
Maybe have anyone a idea?
Make the counting with a cObject like lib.newscount
then you pass that with the cObject Viewhelper like:
<f:cObject typoscriptObjectPath="lib.newscount"></f:cObject>