![](/img/trans.png)
[英]Typo3 11: How to extend sys_file_reference with another sys_file_reference?
[英]How to create a sys_file_reference inside another sys_file_reference?
我需要將一些軌道文件添加到 TYPO3 文件參考中。 所以我擴展了 sys_file_reference 的 TCA 並添加了一些字段。 其中一個字段應該是對另一個文件的引用。 它的工作原理是我可以在后端選擇一個文件
不幸的是,如果我添加了曲目,我將無法保存。 TYPO3 給我一個異常。
#1300098528 InvalidArgumentException 對為 FileReference 提供的原始文件的引用不正確。
發生此異常是因為軌道參考的 uid_local 為 0。但我不知道為什么這是 0 以及如何修復它。
這是我的 TCA 配置
'tx_eos_video_tracks' => [
'exclude' => 1,
'label' => 'Track files',
'description' => 'captions, chapters, descriptions, metadata, subtitles',
'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig('tx_eos_video_tracks', [
'appearance' => [
'createNewRelationLinkTitle' => 'Add Track'
],
'overrideChildTca' => [
'types' => [
'0' => [
'showitem' => '
--palette--;;tx_eos_video_tracks_palette'
]
],
],
], 'vtt,srt')
],
好的,我找到了解決方案。 Child TCA 中必須始終存在字段 uid_local、hidden、sys_language_uid、l10n_parent。 有一個預定義的調色板('filePalette'),它添加字段而不向用戶顯示它們。
如此變化
'overrideChildTca' => [
'types' => [
'0' => [
'showitem' => '
--palette--;;tx_eos_video_tracks_palette'
]
],
],
至
'overrideChildTca' => [
'types' => [
'0' => [
'showitem' => '
--palette--;;tx_eos_video_tracks_palette,
--palette--;;filePalette'
]
],
],
解決了我的問題
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.