[FEATURE] Reusable getCategoryFieldsForTable itemsProcFunc
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Documentation / Changelog / master / Feature-53045-CategorizedFieldsForTableItemsProcFuncInCategoryRegistry.rst
1 .. include:: ../../Includes.txt
2
3 ================================================================================
4 Feature: #53045 - Categorized fields for table itemsProcFunc in CategoryRegistry
5 ================================================================================
6
7 See :issue:`53045`
8
9 Description
10 ===========
11
12 A new method :php:`getCategoryFieldItems()` is added to the :php:`\TYPO3\CMS\Core\Category\CategoryRegistry` class.
13
14 This method can be used as an `itemsProcFunc` in TCA and returns a list of all categorized fields of a table.
15
16 The table for which the categorized fields should be returned can be specified in two ways.
17
18 Static table
19 ------------
20
21 You can provide a static table name in the config of your TCA field:
22
23 .. code-block:: php
24
25 'itemsProcFunc' => \TYPO3\CMS\Core\Category\CategoryRegistry::class . '->getCategoryFieldItems',
26 'categoryFieldsTable' => 'my_table_name',
27
28
29 Dynamic table selection
30 -----------------------
31
32 You can also provide a list of tables. The active table can be selected by using a display condition:
33
34 .. code-block:: php
35
36 'itemsProcFunc' => \TYPO3\CMS\Core\Category\CategoryRegistry::class . '->getCategoryFieldItems',
37 'categoryFieldsTable' => [
38 'categorized_pages' => [
39 'table' => 'pages',
40 'activeCondition' => 'FIELD:menu_type:=:categorized_pages'
41 ],
42 'categorized_content' => [
43 'table' => 'tt_content',
44 'activeCondition' => 'FIELD:menu_type:=:categorized_content'
45 ]
46 ]
47
48
49 Impact
50 ======
51
52 The method :php:`getCategoryFieldsForTable()` is removed. It could only handle the `tt_content` menus
53 `categorized_pages` and `categorized_content`.
54
55 A new method :php:`getCategoryFieldItems()` is added that can be used by third party code for any
56 categorized table.
57
58 .. index:: Backend, PHP-API, TCA