From b9b4a6eb55df194b52cae5cbed5c9f3f4e0cea5f Mon Sep 17 00:00:00 2001 From: "lina.wolf" Date: Sat, 30 Aug 2025 13:06:12 +0200 Subject: [PATCH 1/6] [FEATURE] Add type-specific TCAdefaults support Resolves: https://github.com/TYPO3-Documentation/Changelog-To-Doc/issues/1302 Releases: main --- Documentation/PageTsconfig/TcaDefaults.rst | 48 +++++++++++++++++++--- Documentation/UserTsconfig/TcaDefaults.rst | 44 +++++++++++++++++--- 2 files changed, 81 insertions(+), 11 deletions(-) diff --git a/Documentation/PageTsconfig/TcaDefaults.rst b/Documentation/PageTsconfig/TcaDefaults.rst index 59d6c1b71..14af1c19e 100644 --- a/Documentation/PageTsconfig/TcaDefaults.rst +++ b/Documentation/PageTsconfig/TcaDefaults.rst @@ -8,26 +8,40 @@ TCAdefaults =========== +.. versionadded:: 14.0 + The :typoscript:`TCAdefaults` configuration has been extended to support + type-specific syntax similar to `TCEFORM `_, + enabling different default values based on the record type. + This allows to set or override the `default` values of `TCA` fields that is available -for various TCA types, for instance for :ref:`type=input `. +for various TCA column types, for instance for :ref:`type=input `. -The full path of a setting include the table and the field name: `TCAdefaults.[table name].[field]` +Default values can be set on type level: `TCAdefaults.[table name].[field].types.[type]` +or field level: `TCAdefaults.[table name].[field]`. -This key is also available on :ref:`User TSconfig level `, the order of default +This key is also available on :ref:`User TSconfig level ` the order of default values when creating new records in the backend is this: +#. Database field default value #. Value from `$GLOBALS['TCA']` -#. Value from :ref:`user TSconfig ` -#. Value from page TSconfig (these settings) +#. Field-level ref:`user TSconfig ` +#. Type-level ref:`user TSconfig ` +#. Field-level :typoscript:`TCAdefaults` configuration +#. Type-level :typoscript:`TCAdefaults` configuration #. Value from "defVals" GET variables #. Value from previous record based on :ref:`useColumnsForDefaultValues ` +`TCAdefaults` set via page TSconfig are ignored if the current user has no +write access to the affected field. In this case use +:ref:`User TSconfig level `. + .. note:: `TCAdefaults` is not applied to :ref:`FlexForm ` values. These can only be addressed via :xml:`` elements within the FlexForm data structure. + .. _pageTsTcaDefaults-example: Example: Do not hide newly created pages by default @@ -37,3 +51,27 @@ Example: Do not hide newly created pages by default :caption: EXT:site_package/Configuration/page.tsconfig TCAdefaults.pages.hidden = 0 + +.. _pageTsTcaDefaults-example-type: + +Example: Set type specific default values +========================================= + +.. code-block:: typoscript + :caption: EXT:site_package/Configuration/page.tsconfig + + TCAdefaults.tt_content { + header_layout = 1 + header_layout.types { + textmedia = 3 + image = 2 + } + + frame_class = default + frame_class.types { + textmedia = ruler-before + image = none + } + + space_before_class = none + } diff --git a/Documentation/UserTsconfig/TcaDefaults.rst b/Documentation/UserTsconfig/TcaDefaults.rst index ba294c053..0c5f5feb8 100644 --- a/Documentation/UserTsconfig/TcaDefaults.rst +++ b/Documentation/UserTsconfig/TcaDefaults.rst @@ -7,19 +7,29 @@ TCAdefaults =========== +.. versionadded:: 14.0 + The :typoscript:`TCAdefaults` configuration has been extended to support + type-specific syntax enabling different default values based on the record type. + This allows to set or override the `default` values of `TCA` fields that is available -for various TCA types, for instance for :ref:`type=input `. +for various TCA column types, for instance for :ref:`type=input `. -The full path of a setting include the table and the field name: `TCAdefaults.[table name].[field]` +Default values can be set on type level: `TCAdefaults.[table name].[field].types.[type]` +or field level: `TCAdefaults.[table name].[field]`. This key is also available on :ref:`Page TSconfig level `, the order of default values when creating new records in the backend is this: -#. Value from :php:`$GLOBALS['TCA']` -#. Value from User TSconfig (these settings) -#. Value from :ref:`Page TSconfig ` + +#. Database field default value +#. Value from `$GLOBALS['TCA']` +#. Field-level ref:`user TSconfig ` +#. Type-level ref:`user TSconfig ` +#. Field-level :typoscript:`TCAdefaults` configuration +#. Type-level :typoscript:`TCAdefaults` configuration #. Value from "defVals" GET variables -#. Value from previous record based on 'useColumnsForDefaultValues' +#. Value from previous record based on + :ref:`useColumnsForDefaultValues ` However the order for default values used by :php:`\TYPO3\CMS\Core\DataHandling\DataHandler` if a certain field is not granted access to for user will be: @@ -62,3 +72,25 @@ of an extension: :caption: EXT:site_package/Configuration/TCA/Overrides/pages.php $GLOBALS['TCA']['pages']['ctrl']['useColumnsForDefaultValues'] = 'doktype,fe_group'; + +.. _userTsTcaDefaults-example-types: + +Example: Set type specific default values in user TSconfig +========================================================== + +.. code-block:: typoscript + :caption: EXT:site_package/Configuration/user.tsconfig + + TCAdefaults.tt_content { + header_layout = 1 + # Use specific default values for certain types + header_layout.types { + textmedia = 3 + image = 2 + } + } + +In this example: If a user with no write access to the field `tt_content.header_layout` +creates a new content element of type `textmedia` the header layout will be set +to 3. If the user does have write access to the field, 3 will be used as default +and they may change it. From 012b1da85089eebb8e04ecd79d2f48ee360b5f31 Mon Sep 17 00:00:00 2001 From: Lina Wolf <48202465+linawolf@users.noreply.github.com> Date: Thu, 11 Sep 2025 16:36:06 +0200 Subject: [PATCH 2/6] Update Documentation/UserTsconfig/TcaDefaults.rst MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Stefan Frömken <123929835+sfroemkenjw@users.noreply.github.com> --- Documentation/UserTsconfig/TcaDefaults.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/UserTsconfig/TcaDefaults.rst b/Documentation/UserTsconfig/TcaDefaults.rst index 0c5f5feb8..71aeed70b 100644 --- a/Documentation/UserTsconfig/TcaDefaults.rst +++ b/Documentation/UserTsconfig/TcaDefaults.rst @@ -15,7 +15,7 @@ This allows to set or override the `default` values of `TCA` fields that is avai for various TCA column types, for instance for :ref:`type=input `. Default values can be set on type level: `TCAdefaults.[table name].[field].types.[type]` -or field level: `TCAdefaults.[table name].[field]`. +or field level: `TCAdefaults.[table name].[field]`. This key is also available on :ref:`Page TSconfig level `, the order of default values when creating new records in the backend is this: From 8744fdae5f40b368f3539ebc643f21b5c707816e Mon Sep 17 00:00:00 2001 From: Lina Wolf <48202465+linawolf@users.noreply.github.com> Date: Thu, 11 Sep 2025 16:46:06 +0200 Subject: [PATCH 3/6] Update Documentation/PageTsconfig/TcaDefaults.rst --- Documentation/PageTsconfig/TcaDefaults.rst | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Documentation/PageTsconfig/TcaDefaults.rst b/Documentation/PageTsconfig/TcaDefaults.rst index 14af1c19e..03d18b162 100644 --- a/Documentation/PageTsconfig/TcaDefaults.rst +++ b/Documentation/PageTsconfig/TcaDefaults.rst @@ -32,10 +32,6 @@ values when creating new records in the backend is this: #. Value from previous record based on :ref:`useColumnsForDefaultValues ` -`TCAdefaults` set via page TSconfig are ignored if the current user has no -write access to the affected field. In this case use -:ref:`User TSconfig level `. - .. note:: `TCAdefaults` is not applied to :ref:`FlexForm ` values. These can only be addressed via :xml:`` elements within the From b31a93c7b6307dcba528271c40011070429da4e2 Mon Sep 17 00:00:00 2001 From: Sarah McCarthy Date: Thu, 11 Sep 2025 17:20:50 +0200 Subject: [PATCH 4/6] [TASK] Language checks Releases:main --- Documentation/PageTsconfig/TcaDefaults.rst | 18 +++++++++------- Documentation/UserTsconfig/TcaDefaults.rst | 25 ++++++++++++---------- 2 files changed, 24 insertions(+), 19 deletions(-) diff --git a/Documentation/PageTsconfig/TcaDefaults.rst b/Documentation/PageTsconfig/TcaDefaults.rst index 03d18b162..4afb9bdf6 100644 --- a/Documentation/PageTsconfig/TcaDefaults.rst +++ b/Documentation/PageTsconfig/TcaDefaults.rst @@ -13,14 +13,16 @@ TCAdefaults type-specific syntax similar to `TCEFORM `_, enabling different default values based on the record type. -This allows to set or override the `default` values of `TCA` fields that is available -for various TCA column types, for instance for :ref:`type=input `. +This allows the `default` values of `TCA` fields available +for various TCA column types to be set or overridden, for instance for +:ref:`type=input `. -Default values can be set on type level: `TCAdefaults.[table name].[field].types.[type]` -or field level: `TCAdefaults.[table name].[field]`. +Default values can be set at the type level: `TCAdefaults.[table name].[field].types.[type]` +or field level: `TCAdefaults.[table name].[field]` -This key is also available on :ref:`User TSconfig level ` the order of default -values when creating new records in the backend is this: +This key is also available at the :ref:`User TSconfig level `. +The order of setting default values when creating new records in the backend is +this: #. Database field default value #. Value from `$GLOBALS['TCA']` @@ -33,8 +35,8 @@ values when creating new records in the backend is this: :ref:`useColumnsForDefaultValues ` .. note:: - `TCAdefaults` is not applied to :ref:`FlexForm ` values. - These can only be addressed via :xml:`` elements within the + `TCAdefaults` are not applied to :ref:`FlexForm ` values. + These can only be set via :xml:`` elements within the FlexForm data structure. diff --git a/Documentation/UserTsconfig/TcaDefaults.rst b/Documentation/UserTsconfig/TcaDefaults.rst index 71aeed70b..0d9b9c880 100644 --- a/Documentation/UserTsconfig/TcaDefaults.rst +++ b/Documentation/UserTsconfig/TcaDefaults.rst @@ -11,14 +11,16 @@ TCAdefaults The :typoscript:`TCAdefaults` configuration has been extended to support type-specific syntax enabling different default values based on the record type. -This allows to set or override the `default` values of `TCA` fields that is available -for various TCA column types, for instance for :ref:`type=input `. +This allows `default` values of `TCA` fields that are available for various TCA +column types to be set or overridden, for instance for +:ref:`type=input `. -Default values can be set on type level: `TCAdefaults.[table name].[field].types.[type]` -or field level: `TCAdefaults.[table name].[field]`. +Default values can be set at the type level: `TCAdefaults.[table name].[field].types.[type]` +or field level: `TCAdefaults.[table name].[field]` -This key is also available on :ref:`Page TSconfig level `, the order of default -values when creating new records in the backend is this: +This key is also available at the :ref:`Page TSconfig level `. +The order that default values are set when creating new records in the backend +is this: #. Database field default value @@ -31,13 +33,14 @@ values when creating new records in the backend is this: #. Value from previous record based on :ref:`useColumnsForDefaultValues ` -However the order for default values used by :php:`\TYPO3\CMS\Core\DataHandling\DataHandler` if a certain -field is not granted access to for user will be: +However, the order for default values used by the +:php:`\TYPO3\CMS\Core\DataHandling\DataHandler` if a particular field is inaccessible +to a user will be: #. Value from :php:`$GLOBALS['TCA']` #. Value from User TSconfig (these settings) -So these values will be authoritative if the user has no access to the field anyway. +So these will be the values that are set if the user has no access to the field anyway. Example: @@ -90,7 +93,7 @@ Example: Set type specific default values in user TSconfig } } -In this example: If a user with no write access to the field `tt_content.header_layout` +In this example: if a user with no write access to the field `tt_content.header_layout` creates a new content element of type `textmedia` the header layout will be set -to 3. If the user does have write access to the field, 3 will be used as default +to 3. If the user does have write access to the field, 3 will be used by default and they may change it. From c128809a434b790303517a576c8629d459240055 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Fr=C3=B6mken?= Date: Thu, 11 Sep 2025 17:53:53 +0200 Subject: [PATCH 5/6] Update Documentation/PageTsconfig/TcaDefaults.rst --- Documentation/PageTsconfig/TcaDefaults.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/PageTsconfig/TcaDefaults.rst b/Documentation/PageTsconfig/TcaDefaults.rst index 4afb9bdf6..7585dd977 100644 --- a/Documentation/PageTsconfig/TcaDefaults.rst +++ b/Documentation/PageTsconfig/TcaDefaults.rst @@ -18,7 +18,7 @@ for various TCA column types to be set or overridden, for instance for :ref:`type=input `. Default values can be set at the type level: `TCAdefaults.[table name].[field].types.[type]` -or field level: `TCAdefaults.[table name].[field]` +or field level: `TCAdefaults.[table name].[field]` This key is also available at the :ref:`User TSconfig level `. The order of setting default values when creating new records in the backend is From 3845c35db924ce4a926c0da0942c81d23297a9ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Fr=C3=B6mken?= Date: Thu, 11 Sep 2025 17:56:16 +0200 Subject: [PATCH 6/6] Update Documentation/UserTsconfig/TcaDefaults.rst --- Documentation/UserTsconfig/TcaDefaults.rst | 1 - 1 file changed, 1 deletion(-) diff --git a/Documentation/UserTsconfig/TcaDefaults.rst b/Documentation/UserTsconfig/TcaDefaults.rst index 0d9b9c880..a5606c737 100644 --- a/Documentation/UserTsconfig/TcaDefaults.rst +++ b/Documentation/UserTsconfig/TcaDefaults.rst @@ -22,7 +22,6 @@ This key is also available at the :ref:`Page TSconfig level ` The order that default values are set when creating new records in the backend is this: - #. Database field default value #. Value from `$GLOBALS['TCA']` #. Field-level ref:`user TSconfig `