Bug #87652
closedSoftReferenceIndex :: TypoLink :: links like "t3:// FileLinks" won't be recognized
0%
Description
Our customer has complained about missing references in the file list.
After some debugging, we noticed the following:
We have some extensions which have some input fields as typolinks:
<config type="array"> <type>input</type> <renderType>inputLink</renderType> <softref>typolink</softref> <size>100</size> <max>512</max> <eval>trim</eval> <fieldControl> <linkPopup> <options> <title>Link</title> </options> </linkPopup> </fieldControl> </config>
The SoftReferenceIndexer does not recognize those links, so the filelist does show zeros references, and our client startet to delete those files.
The problem is located inside the function
TYPO3\CMS\Core\Database\SoftReferenceIndex::getTypoLinkParts
Old Code:
// Check for FAL link-handler keyword
if ($linkHandlerKeyword === 'file') {
$finalTagParts['LINK_TYPE'] = 'file';
$finalTagParts['identifier'] = trim($link_param);
return $finalTagParts;
}
This will only work for old-syntaxed file links like "file:nnnn" but not for the new syntax "t3://file::".
I've added the followeing code snipped, fot the new syntax file links:
if ($linkHandlerKeyword === 't3') {
// linking to any t3:// syntax
if (stripos($link_param, 't3://') === 0) {
// lets parse the urn
$linkParsed = parse_url($link_param);
if (isset($linkParsed['host']) && isset($linkParsed['scheme']) && isset($linkParsed['query'])){
$identifier = $linkParsed['host'];
$scheme = $linkParsed['scheme'];
$query = $linkParsed['query'];
$finalTagParts['LINK_TYPE'] = $identifier;
if($query && $identifier === 'file' ){
$queryparts = explode('=', $query);
if($queryparts){
if(is_array($queryparts)){
$queryKey = $queryparts[0];
$queryValue = (integer) $queryparts[1];
if (is_int($queryValue)){
$finalTagParts['identifier'] = "$identifier:$queryValue";
unset($linkParsed);
unset($queryparts);
return $finalTagParts;
}
}
}
}
}
}
}
When saving those records in the backend or when we trigger to rebuild the refindex, those links will now be recognized.
Files