Attention
TYPO3 v11 has reached end-of-life as of October 31th 2024 and is no longer being maintained. Use the version switcher on the top left of this page to select documentation for a supported version of TYPO3.
Need more time before upgrading? You can purchase Extended Long Term Support (ELTS) for TYPO3 v10 here: TYPO3 ELTS.
treeConfig
treeConfig
-
- Type
- array
- Path
- $GLOBALS['TCA'][$table]['columns'][$field]['config']
- Scope
- Display
- RenderType
- selectTree
Either
children
orField parent
has to be set -Field children
takes precedence. Keywords:Field - dataProvider
- Allows to define a custom data provider class for usecases where special data preparation
is necessary. By default
\TYPO3\CMS\Core\Tree\TableConfiguration\DatabaseTreeDataProvider
is used. - childrenField (string)
- Field name of the foreign_table that references the uid of the child records.
- parentField (string)
- Field name of the foreign_table that references the uid of the parent record
- rootUid (integer, optional)
- Deprecated, use startingPoints (see below); uid of the record that shall be considered as the root node of the tree.
- startingPoints (string, comma separated values)
-
allows to set multiple records as roots for tree records.
The setting takes a CSV value, e.g.
2,3,4711
, which takes records of the pids2
,3
and4711
into account and creates a tree of these records.Additionally, each value used in
starting
may be fed from a site configuration by using thePoints ###SITE:###
syntax.This property can also be set by page TSconfig, see config.treeConfig
Example:
# Site config base: / rootPageId: 1 categories: root: 123
Copied!// Example TCA config 'config' => [ 'treeConfig' => [ 'startingPoints' => '1,2,###SITE:categories.root###', ], ],
Copied! - appearance (array, optional)
- showHeader (boolean)
- Whether to show the header of the tree that contains a field to filter the records and allows to expand or collapse all nodes
- expandAll (boolean)
- Whether to show the tree with all nodes expanded
- maxLevels (integer)
- The maximal amount of levels to be rendered (can be used to stop possible recursions)
- nonSelectableLevels (list, default "0")
- Comma-separated list of levels that will not be selectable, by default the root node (which is "0") cannot be selected
Examples
Tree with non selectable levels
[
'columns' => [
'select_tree_2' => [
'exclude' => 1,
'label' => 'select_tree_2 pages, showHeader=false, nonSelectableLevels=0,1, maxitems=4, size=10',
'config' => [
'type' => 'select',
'renderType' => 'selectTree',
'foreign_table' => 'pages',
'maxitems' => 4,
'size' => 10,
'treeConfig' => [
'parentField' => 'pid',
'appearance' => [
'expandAll' => true,
'showHeader' => false,
'nonSelectableLevels' => '0,1',
],
],
],
],
],
]