Viewhelper f:link.typolink in TYPO3 9.5 LTS - typo3

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

Related

TYPO3 10.4: tx_news content elements rendering error

I am updating TYPO3 from Version 8 to 9 and 10. Now there is one error, I am not able to find a solution.
In tx_news details view I am using custom fluid templates. In TYPO3 8 and 9 everything works fine. In TYPO3 10.4 I get an error when showing the detail page:
(1/1) #1381512761 TYPO3\CMS\Core\Type\Exception\InvalidEnumerationValueException
Invalid value "FILE" for enumeration "TYPO3\CMS\Core\DataHandling\TableColumnSubType"
If I remove this code for content elements in the fluid template, the page will be shown without errors:
<f:if condition="{newsItem.contentElements}">
<!-- content elements -->
<f:cObject typoscriptObjectPath="lib.tx_news.contentElementRendering">{newsItem.contentElementIdList}</f:cObject>
</f:if>
As I'm using content elements, I need this code.
You can see the error at the moment here:
https://asienhaus104.der-koenig.net/aktuelles/detail/spenden-fuer-die-suedostasien
I tried lots of variants to solve this, but still the error will be there when I insert the fluid output for content elements.
It seems you have a content element inside which is rendered in TypoScript with the FILE object (which was removed in v10). Take a look in your TypoScript (TypoScript object browser is best for this) and search for FILE objects (and replace them).
Here you can find the deprecation notice and a migration suggestion: https://docs.typo3.org/c/typo3/cms-core/main/en-us/Changelog/9.5/Deprecation-85970-FileContentObject.html

How to show username in frontend in TYPO3 10?

In TYPO3 9 I managed to display the current username in a FLUID-template with the following Typoscript:
[loginUser=*]
temp.username = TEXT
temp.username {
insertData = 1
value = {TSFE:fe_user|user|username}
noTrimWrap = | ||
}
[global]
In TYPO3 10.4 this is not working anymore. Any idea how to display the current user?
Many thanks! Urs
In Typo3 V10, you have to use the Context API to retrieve data from global objects, try this :
[frontend.user.isLoggedIn]
temp.username = TEXT
temp.username.data = TSFE:fe_user|user|name
temp.username.wrap = |
[global]
Have a look at those links :
https://docs.typo3.org/m/typo3/reference-typoscript/master/en-us/DataTypes/Index.html
https://docs.typo3.org/m/typo3/reference-coreapi/master/en-us/ApiOverview/Context/Index.html#context-api
Florian
It's probably not working because you're using the old TypoScript conditions. Since TYPO3 9 the conditions work with Symfony expressions. The old conditions were deprecated in TYPO3 9 (but still worked) and removed in TYPO3 10. So [loginUser=*] will never be true in TYPO3 10. You should use [frontend.user.isLoggedIn] instead.
See https://docs.typo3.org/m/typo3/reference-typoscript/master/en-us/Conditions/Index.html for more about the new TypoScript conditions.
Why use TypoScript? It is very limited on what it can bring back. I just finished a tutorial where you can use a ViewHelper to add an ExtBase variable which assigns the whole user object in the FrontEnd and you can use it wherever you want with all it's relations, even the image, which is difficult to get via TypoScript.
TYPO3 tutorial
Best regards

Fluid Typolink ViewHelper ignores additionalParams-attribute

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

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.

Typo3 7.6.2 - missing the RealURL option "Override the whole page path "

I have Typo3 7.6.2 and RealURL 1.13.15, whis is for Typo3 4.5.40-7.9.999
In Typo3 < 7 there was option "Override the whole page path "
In Typo3 7.6.2 seems this option is not present.
In the language file of RealUrl is:
<label index="pages.tx_realurl_path_override">Override the whole page path</label>
But in BE of Typo3 i can't find this option
My config is:
'realurl' => 'a:5:{s:10:"configFile";s:26:"typo3conf/realurl_conf.php";s:14:"enableAutoConf";s:1:"1";s:14:"autoConfFormat";s:1:"0";s:12:"enableDevLog";s:1:"0";s:19:"enableChashUrlDebug";s:1:"0";}'
Any Idea?
Take a look into typo3conf/ext/realurl/ext_tables.php:78 there are these lines which according to #deprecated comment in typo3/sysext/core/Classes/Utility/ExtensionManagementUtility.php:318 in version 7.x+ as I hardly believe should be replaced:
$extensionMamagementUtility::addToAllTCAtypes('pages', 'tx_realurl_pathsegment;;137;;,tx_realurl_exclude', '1', 'after:nav_title');
$extensionMamagementUtility::addToAllTCAtypes('pages', 'tx_realurl_pathsegment;;137;;,tx_realurl_exclude', '4,199,254', 'after:title');
with:
$extensionMamagementUtility::addToAllTCAtypes('pages', 'tx_realurl_pathsegment, --palette--;;137, tx_realurl_exclude', '1', 'after:nav_title');
$extensionMamagementUtility::addToAllTCAtypes('pages', 'tx_realurl_pathsegment, --palette--;;137, tx_realurl_exclude', '4,199,254', 'after:title');
You can probably override the TCA within your own ext, or just hack the RealURL source (dirty solution) anyway must accent that I have no idea what is Dmitry's intension. (In other words I don't know if it's bug, or a feature ;))