The Typo3 Configuration Array (TCA) configuration of the extension is very simple. The tree is a form element of type “select”. You can read about it in the chapter $TCA array reference in the “Typo3 Core APIs” documentation on www.typo3.org. In short it has a userFunc pointing to the function “displayCategoryTree” of the class “tx_ch_treeview”. I have introduced a new field “treeName” containing the unique name of the tree in the “feInterface” section. The name must be unique because I had an extension, where I needed multiple trees in the same form. I have introduced another field in the “ctrl” section. “TreeParentField” contains the name of the parent field of the table.
Example TCA of the extension:
ctrl section:
'title' => 'LLL:EXT:ch_treeview/locallang_db.xml:tx_chtreeview_example',
'label' => 'title',
'tstamp' => 'tstamp',
'crdate' => 'crdate',
'cruser_id' => 'cruser_id',
'default_sortby' => 'ORDER BY crdate',
'delete' => 'deleted',
'treeParentField' => 'parent_uid',
feInterface section:
<type>select</type>
<form_type>user</form_type>
<treeView>1</treeView>
<treeName>txchtreeviewexample</treeName>
<userFunc>tx_ch_treeview->displayCategoryTree</userFunc>
<foreign_table>tx_chtreeview_example</foreign_table>
<size>10</size>
<autoSizeMax>20</autoSizeMax>
<minitems>0</minitems>
<maxitems>20</maxitems>
Key: | Data type: | Description: | Default: |
|---|---|---|---|
treeParentField | string | Contains the name of the pointer field in the table |