Reputation: 314
In my custom extensions’ TCA I am updating FAL reference fields to work with TYPO3 v12/v13. Previously I had defined a fieldname which was a camelCase version of the TCA/SQL fieldname (imgRel
for img_rel
: first argument of getFileFieldTCAConfig()
) This camelCase value is now stored under sys_file_reference.fieldname
– but TYPO3v12 searches for img_rel
and therefore does not show referenced files.
Question: How can I get this fieldname into the configuration for the TCA type file
?
Example of a configuration for TYPO3 < 12:
'img_rel' => [
'label' => 'Image',
'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig(
'imgRel',
['maxitems' => 1],
$GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']
),
],
Same example as above for TYPO3 >= 12:
I cannot find a fieldname
property or anything similar in the documentation.
'img_rel' => [
'label' => 'Image',
'config' => [
'type' => 'file',
'maxitems' => 1,
'allowed' => 'common-image-types',
]
],
Upvotes: 2
Views: 174
Reputation: 556
The "fieldname" is automatically joined to the TCA fieldname you called "img_rel". So you either have to rename "img_rel" to "imgRel" in your database column attribute, OR you have to use "img_rel" and create a DB upgrade wizard step (or manual SQL statement) that fixes your existing sys_file_reference fieldname entries.
Upvotes: 2