Typo3 select filled with childs category from sys_category

354 views Asked by At

I'm writing a TCA to define a form, and I need to fill the select with the childs categories from sys_category table.

'category' => [
            'label' => 'LLL:EXT:hebo_ideas/Resources/Private/Language/locallang_db.xlf:hk_ideas_idea.category',
            'config' => [
                'type' => 'select',
                'renderType' => 'selectSingle',
                'foreign_table' => 'sys_category',
                'foreign_table_where' => ' AND sys_category.sys_language_uid IN (-1, 0) ORDER BY sys_category.sorting ASC',
                'MM' => 'sys_category_record_mm',
                'size' => 10
            ],
         ],

I understand that I have to use foreign_table_where but I don't know what parameter from TYPO3 core database should I use to filter this categories by parent. Or may be my approach is wrong?

1

There are 1 answers

0
Peter Kraume On

If you want to add categories to your table, you should use \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::makeCategorizable(). Thats the easiest way. Please have a look at the documentation for details.