如何在 TYPO3 的自定义模型中 use/link sys_category 字段

How to use/link sys_category field in custom model in TYPO3

我正在开发一个扩展程序,我在其中上传文件,对于每个文件上传,我需要有一个或多个与之关联的类别。

我已经构建了一个自定义类别模型,它在创建记录时在后端显示正常,但我想 show/link sys_category 记录而不是我自己的自定义类别。

如何 link 我的自定义模型中的那个字段?

如果其他人无意中发现了这个问题,感谢@larry-pete,我从文档中找到了解决方案。

只需将这些行添加到扩展文件夹中的 ext_tables.php 文件即可。

// Add an extra categories selection field to the pages table
    \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::makeCategorizable(
        'ext_key',
        'your_table_name',
        'categories',
        array(
            // Set a custom label
            'label' => 'LLL:EXT:ext_key/Resources/Private/Language/locallang.xlf:additional_categories',
            // This field should not be an exclude-field
            'exclude' => FALSE,
            // Override generic configuration, e.g. sort by title rather than by sorting
            'fieldConfiguration' => array(
                'foreign_table_where' => ' AND sys_category.sys_language_uid IN (-1, 0) ORDER BY sys_category.title ASC',
            ),
            // string (keyword), see TCA reference for details
            'l10n_mode' => 'exclude',
            // list of keywords, see TCA reference for details
            'l10n_display' => 'hideDiff',
        )
    );

希望对大家有所帮助。