-
Notifications
You must be signed in to change notification settings - Fork 137
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TASK] Overhaul category type (#995)
* [TASK] Overhaul category type * Correct indentation, * add names for confvals releases: main, 12.4, 11.5 * Update Documentation/ColumnsConfig/Type/Category/Properties/ForeignTablePrefix.rst Co-authored-by: Chris Müller <[email protected]> --------- Co-authored-by: Chris Müller <[email protected]> (cherry picked from commit 1c03d51)
- Loading branch information
Showing
10 changed files
with
156 additions
and
157 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,43 @@ | ||
.. include:: /Includes.rst.txt | ||
.. include:: /Includes.rst.txt | ||
|
||
.. _columns-category: | ||
.. _columns-category: | ||
|
||
======== | ||
Category | ||
======== | ||
|
||
.. versionadded:: 11.4 | ||
The TCA field type called `category` has been added to TYPO3 Core. Its main | ||
purpose is to simplify the TCA configuration when adding a category | ||
tree to a record. It therefore supersedes the :php:`CategoryRegistry` as well | ||
as the :php:`ExtensionManagementUtility->makeCategorizable()`, which has required | ||
creating a "TCA overrides" file. | ||
.. versionadded:: 11.4 | ||
The TCA field type called `category` has been added to TYPO3 Core. Its main | ||
purpose is to simplify the TCA configuration when adding a category | ||
tree to a record. It therefore supersedes the :php:`CategoryRegistry` as well | ||
as the :php:`ExtensionManagementUtility->makeCategorizable()`, which has required | ||
creating a "TCA overrides" file. | ||
|
||
While using the type :php:`category`, TYPO3 takes care of generating the | ||
necessary TCA configuration. | ||
Developers only have to define the TCA column and add :php:`category` as the | ||
desired TCA type in the tables's TCA file (inside or outside of the Overrides folder). | ||
|
||
.. include:: /CodeSnippets/Manual/CategorySimple.rst.txt | ||
.. include:: /CodeSnippets/Manual/CategorySimple.rst.txt | ||
|
||
The following options can be overridden via :ref:`page TSconfig, TCE form | ||
<t3tsconfig:pageTsConfigTceFormConfig>`: | ||
|
||
* `size` | ||
* `maxitems` | ||
* `minitems` | ||
* `readOnly` | ||
* `treeConfig` | ||
* `size` | ||
* `maxitems` | ||
* `minitems` | ||
* `readOnly` | ||
* `treeConfig` | ||
|
||
.. note:: | ||
|
||
.. note:: | ||
It is still possible to configure a category tree with `type=select` | ||
and `renderType=selectTree` when you want to override specific fields, | ||
but in most cases the simplified :php:`category` TCA type is sufficient. | ||
|
||
It is still possible to configure a category tree with `type=select` | ||
and `renderType=selectTree`. This configuration will still work, but | ||
it can in most cases be simplified by using the new :php:`category` TCA type. | ||
|
||
.. toctree:: | ||
:titlesonly: | ||
|
||
.. toctree:: | ||
:titlesonly: | ||
|
||
Examples | ||
Properties/Index | ||
Examples | ||
Properties/Index |
20 changes: 10 additions & 10 deletions
20
Documentation/ColumnsConfig/Type/Category/Properties/Default.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
.. include:: /Includes.rst.txt | ||
.. _columns-category-properties-default: | ||
.. include:: /Includes.rst.txt | ||
.. _columns-category-properties-default: | ||
|
||
============= | ||
default value | ||
============= | ||
|
||
.. confval:: default | ||
.. confval:: default | ||
:name: category-default | ||
:Path: $GLOBALS['TCA'][$table]['columns'][$field]['config'] | ||
:type: string | ||
:Scope: Display / Proc. | ||
:RenderType: all | ||
|
||
:Path: $GLOBALS['TCA'][$table]['columns'][$field]['config'] | ||
:type: string | ||
:Scope: Display / Proc. | ||
:RenderType: all | ||
|
||
Default value set if a new record is created. If empty, no category gets | ||
selected. | ||
Default value set if a new record is created. If empty, no category gets | ||
selected. |
22 changes: 11 additions & 11 deletions
22
Documentation/ColumnsConfig/Type/Category/Properties/ExclusiveKeys.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
.. include:: /Includes.rst.txt | ||
.. _columns-category-properties-exclusivekeys: | ||
.. include:: /Includes.rst.txt | ||
.. _columns-category-properties-exclusivekeys: | ||
|
||
============= | ||
exclusiveKeys | ||
============= | ||
|
||
.. confval:: exclusiveKeys | ||
.. confval:: exclusiveKeys | ||
:name: category-exclusiveKeys | ||
:Path: $GLOBALS['TCA'][$table]['columns'][$field]['config'] | ||
:type: string (list of) | ||
:Scope: Display / Proc. | ||
:RenderType: all | ||
|
||
:Path: $GLOBALS['TCA'][$table]['columns'][$field]['config'] | ||
:type: string (list of) | ||
:Scope: Display / Proc. | ||
:RenderType: all | ||
|
||
List of keys that exclude any other keys in a select box where multiple | ||
items could be selected. See also :ref:`property exclusiveKeys of selectTree | ||
<columns-select-properties-exclusivekeys>`. | ||
List of keys that exclude any other keys in a select box where multiple | ||
items could be selected. See also :ref:`property exclusiveKeys of selectTree | ||
<columns-select-properties-exclusivekeys>`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
84 changes: 42 additions & 42 deletions
84
Documentation/ColumnsConfig/Type/Category/Properties/Relationship.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,47 @@ | ||
.. include:: /Includes.rst.txt | ||
.. _columns-category-properties-relationship: | ||
.. include:: /Includes.rst.txt | ||
.. _columns-category-properties-relationship: | ||
|
||
============ | ||
relationship | ||
============ | ||
|
||
.. confval:: relationship | ||
|
||
:Path: $GLOBALS['TCA'][$table]['columns'][$field]['config'] | ||
:type: string | ||
:Scope: Display / Proc. | ||
:RenderType: all | ||
:Default: manyToMany | ||
|
||
All possible values are: | ||
|
||
`oneToOne` | ||
Stores the uid of the selected category. When using this | ||
relationship, `maxitems=1` will automatically be added to | ||
the column configuration. While one record can only have a | ||
relation to one category, each category can | ||
still have a relationship to more then one record. | ||
|
||
`oneToMany` | ||
Stores the uids of selected categories in a comma-separated list. | ||
|
||
`manyToMany` (default): | ||
Uses the intermediate table :sql:`sys_category_record_mm` | ||
and only stores the categories count on the local side. This is the use | ||
case, which was previously accomplished using | ||
:php:`ExtensionManagementUtility->makeCategorizable()`. | ||
|
||
In the following example a category tree is displayed, but only one | ||
category can be selected. It is | ||
|
||
.. code-block:: php | ||
$GLOBALS['TCA'][$myTable]['columns']['mainCategory'] = [ | ||
'config' => [ | ||
'type' => 'category', | ||
'relationship' => 'oneToOne' | ||
] | ||
]; | ||
All other relevant options, for example `maxitems=1`, are being set | ||
automatically. | ||
.. confval:: relationship | ||
:name: category-relationship | ||
:Path: $GLOBALS['TCA'][$table]['columns'][$field]['config'] | ||
:type: string | ||
:Scope: Display / Proc. | ||
:RenderType: all | ||
:Default: manyToMany | ||
|
||
All possible values are: | ||
|
||
`oneToOne` | ||
Stores the uid of the selected category. When using this | ||
relationship, `maxitems=1` will automatically be added to | ||
the column configuration. While one record can only have a | ||
relation to one category, each category can | ||
still have a relationship to more then one record. | ||
|
||
`oneToMany` | ||
Stores the uids of selected categories in a comma-separated list. | ||
|
||
`manyToMany` (default): | ||
Uses the intermediate table :sql:`sys_category_record_mm` | ||
and only stores the categories count on the local side. This is the use | ||
case, which was previously accomplished using | ||
:php:`ExtensionManagementUtility->makeCategorizable()`. | ||
|
||
In the following example a category tree is displayed, but only one | ||
category can be selected. | ||
|
||
.. code-block:: php | ||
$GLOBALS['TCA'][$myTable]['columns']['mainCategory'] = [ | ||
'config' => [ | ||
'type' => 'category', | ||
'relationship' => 'oneToOne' | ||
] | ||
]; | ||
All other relevant options, for example `maxitems=1`, are being set | ||
automatically. |
Oops, something went wrong.