Bug #14634
closedTypolink to a page with certain type doesn't work if type is zero
0%
Description
Look at the the following typoscript code:
20 = TEXT
20.value = Template wechseln
20.typolink.parameter.data = field:uid
20.typolink.parameter.wrap = |,0
So I want to make a link to the current page with typenumber 0 set ( I needed this to make a link for the user to change the type of the page to 1 and vice versa).
If you enter a number else than 0, all works fine. But 0 doesn't work.
So here is how I solved it:
After some reverse engineering I came across the method "linkData" in class "t3lib_TSTemplate". The typenum given above is passed as the last parameter. In the comment it means:
"If you set this value to something else than a blank string, then the typeNumber used in the link will be forced to this value. Normally the typeNum is based on the target set OR on $GLOBALS['TSFE']->config['config']['forceTypeValue'] if found."
OK, so far so good. But some lines later, the code (line 1311) is the following:
//line 1310
if (!$typeOverride && intval($GLOBALS['TSFE']->config['config']['forceTypeValue'])) {
//line 1312
So actually it is not tested on an empty string but on an "empty" value! As PHP interprets 0 as empty (it doesn't get passed as string but as number) the test actually passes and the typenum from forceTypeValue" is inserted.
So I changed the line and now it works:
if ($typeOverride == '' && intval($GLOBALS['TSFE']->config['config']['forceTypeValue'])) {
Now it's done exactly what is mentioned in the comment.
(issue imported from #M931)
Updated by Mathias Schreiber over 18 years ago
TYPO3 Version too old.
The reported version is no longer maintained.
If this bug still persists in 4.0.1, please re-open it again and set the field "Product Version" to the corresponding version.
Updated by Thorsten Kahler almost 18 years ago
The bug still exists in branch TYPO3_4-0 and trunk.
Updated by Thorsten Kahler almost 18 years ago
Fixed in branch TYPO_4-0 and trunk.