[TYPO3-dev] FAL: problem with "link" wizard and browse_links.php in TCA

Helmut Hummel helmut.hummel at typo3.org
Sat Sep 7 11:35:48 CEST 2013


Hi Jochen,

On 06.09.13 17:25, Jochen Rieger wrote:

> But … now of course chosing a file in the popup will fill the file:1234
> relation syntax into the input field. So … I'm afraid, my question of
> the initial post remains.
>
> The other option would be to use FAL relations and make use of the API
> in the Plugin. But… the we would need to convert all the old file path
> values to file id strings.

You have a field with a link wizard configured in TCA.

The link wizard is able to generate strings like this:

"308 _blank css title foo=3"

So a link string can consist of 5 parts:

1. Link (can be integer for link to internal page, ...)
2. HTML target attribute value
3. CSS class value
4. title attribute value
5. additional parameter(s) for the link

This is like that since TYPO3 4.0 (or prior to that).
So using the string directly in a <a href=""> without parsing has been 
wrong since then. However it worked before FAL, because links to files 
were just relative paths and now with FAL they are identified by the 
"file:" prefix followed by an integer id (as you pointed out).

Long story short, if you use the proper typolink API, then the string 
properly gets converted to an "<a>" tag taking all editorial features 
and FAL into account while being backwards compatible.

You can use the PHP API like this:


$databaseFieldString = '308 _blank css title foo=3';
$textToBeLinked = 'click me';
$html = $cObj->getTypoLink($textToBeLinked, $databaseFieldString);

$html will contain sth. this: "<a href="index.php?id=308&foo=3" 
target="_blank" class="css" title="title">click me</a>

Or you can render this with TypoScript

lib.foo = TEXT
lib.foo.field = label_field
lib.foo.htmlSpecialChars = 1
lib.foo.typolink.parameter.field = link_field


HTH

Kind regards,
Helmut

-- 
Helmut Hummel
Release Manager TYPO3 6.0
TYPO3 Core Developer, TYPO3 Security Team Member

TYPO3 .... inspiring people to share!
Get involved: typo3.org



More information about the TYPO3-dev mailing list