From 458e9c7ee48d258a87f94ff2ceb64efc8d165bcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chris=20M=C3=BCller?= <2566282+brotkrueml@users.noreply.github.com> Date: Sun, 8 Oct 2023 12:39:05 +0200 Subject: [PATCH] [FEATURE] #101807 - Automatic inclusion of user TSconfig of extensions Related: https://github.com/TYPO3-Documentation/Changelog-To-Doc/issues/644 Releases: main --- Documentation/UserTsconfig/Options.rst | 10 ++--- Documentation/UsingSetting/UserTSconfig.rst | 42 ++++++++++++++----- .../_UserTSconfig/_ext_localconf.php | 14 ------- .../_UserTSconfig/_ext_localconf_v12.php | 17 ++++++++ 4 files changed, 53 insertions(+), 30 deletions(-) delete mode 100644 Documentation/UsingSetting/_UserTSconfig/_ext_localconf.php create mode 100644 Documentation/UsingSetting/_UserTSconfig/_ext_localconf_v12.php diff --git a/Documentation/UserTsconfig/Options.rst b/Documentation/UserTsconfig/Options.rst index c357fcf8..35286c72 100644 --- a/Documentation/UserTsconfig/Options.rst +++ b/Documentation/UserTsconfig/Options.rst @@ -974,14 +974,12 @@ passwordReset cli command. To completely disable the password reset in the backend for all users, you can - set the user TSconfig globally in your :file:`ext_localconf.php`: + set the user TSconfig globally in your :file:`Configuration/user.tsconfig`: - .. code-block:: php - :caption: EXT:site_package/ext_localconf.php + .. code-block:: typoscript + :caption: EXT:site_package/Configuration/user.tsconfig - \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addUserTSConfig( - 'options.passwordReset = 0' - ); + options.passwordReset = 0 If required, this setting can be overridden on a per user basis in the corresponding :guilabel:`TSconfig` field of the backend diff --git a/Documentation/UsingSetting/UserTSconfig.rst b/Documentation/UsingSetting/UserTSconfig.rst index 95f57551..eb88cdac 100644 --- a/Documentation/UsingSetting/UserTSconfig.rst +++ b/Documentation/UsingSetting/UserTSconfig.rst @@ -56,28 +56,50 @@ both define the same property. Setting default user TSconfig ============================= +.. versionadded:: 13.0 + Starting with TYPO3 v12.0 page TSconfig in a file named + :file:`Configuration/user.tsconfig` in an extension is automatically loaded + during build time. + User TSconfig is designed to be individual for users or groups of users. However, good defaults can be defined and overridden by group or user-specific TSconfig. -In extensions, this is done using the Core API function, -:php:`\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addUserTSConfig()`. -In the :file:`ext_localconf.php` file of your extension you can call it -like this to set a default configuration. +Default page TSconfig should be stored within an extension, usually a +sitepackage extension. The content of the file +:file:`Configuration/user.tsconfig` within an extension is automatically loaded +during build time. + +It is possible to load other user TSconfig files with the import syntax within +this file: + +.. code-block:: typoscript + :caption: EXT:my_extension/Configuration/user.tsconfig + + @import 'EXT:my_sitepackage/Configuration/TsConfig/User/default.tsconfig' -.. literalinclude:: _UserTSconfig/_ext_localconf.php + +User TSconfig, compatible with TYPO3 v12 and v13 +------------------------------------------------ + +In TYPO3 v12 installations the content of :file:`Configuration/user.tsconfig` is +not loaded automatically. You can achieve compatibility with both TYPO3 v12 and +v13 by importing the content of this file with the API function +:php:`ExtensionManagementUtility::addUserTSConfig`: + +.. literalinclude:: _UserTSconfig/_ext_localconf_v12.php :language: php :caption: EXT:my_sitepackage/ext_localconf.php -There is a global :ref:`TYPO3_CONF_VARS ` value called -:ref:`$GLOBALS['TYPO3_CONF_VARS']['BE']['defaultUserTSconfig'] `. -The API function above adds content to that array. However, the array value -itself should **not** be changed or set directly without using the API. - +.. deprecated:: 13.0 + The method :php:`\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addUserTSConfig()` + has been marked as deprecated in TYPO3 v13 and will be removed with TYPO3 + v14. .. index:: pair: User TSconfig; Verify configuration .. _userverifyingthefinalconfiguration: + Verify the final configuration ============================== diff --git a/Documentation/UsingSetting/_UserTSconfig/_ext_localconf.php b/Documentation/UsingSetting/_UserTSconfig/_ext_localconf.php deleted file mode 100644 index 1abfeaa8..00000000 --- a/Documentation/UsingSetting/_UserTSconfig/_ext_localconf.php +++ /dev/null @@ -1,14 +0,0 @@ -getMajorVersion() < 13) { + ExtensionManagementUtility::addUserTSConfig( + '@import "EXT:my_sitepackage/Configuration/user.tsconfig"' + ); +}