From 42271d9b3058a3840f0d80623c81987d52e736ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20Gro=C3=9Fberndt?= <stephan.grossberndt@typo3.org> Date: Mon, 12 Dec 2022 17:33:54 +0100 Subject: [PATCH] [DOCS] Add example for hook modifyBlindedConfigurationOptions Releases: main, 11.5, 10.4 Resolves: #99348 Change-Id: I43d305b0f02bd6049f32e65c95184a2d5bfa4fe5 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/77052 Tested-by: core-ci <typo3@b13.com> Tested-by: Benni Mack <benni@typo3.org> Reviewed-by: Benni Mack <benni@typo3.org> --- ...ideCredentialsInTheConfigurationModule.rst | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/typo3/sysext/core/Documentation/Changelog/9.0/Feature-82999-AddAHookToHideCredentialsInTheConfigurationModule.rst b/typo3/sysext/core/Documentation/Changelog/9.0/Feature-82999-AddAHookToHideCredentialsInTheConfigurationModule.rst index b90ef006a15c..0c237155d766 100644 --- a/typo3/sysext/core/Documentation/Changelog/9.0/Feature-82999-AddAHookToHideCredentialsInTheConfigurationModule.rst +++ b/typo3/sysext/core/Documentation/Changelog/9.0/Feature-82999-AddAHookToHideCredentialsInTheConfigurationModule.rst @@ -11,8 +11,35 @@ Description To blind additional configuration options in the Configuration module a hook has been added: -:php:`$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][\TYPO3\CMS\Lowlevel\ControllerConfigurationController::class]['modifyBlindedConfigurationOptions']` +:php:`$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][\TYPO3\CMS\Lowlevel\Controller\ConfigurationController::class]['modifyBlindedConfigurationOptions']` +This can be implemented e.g. by adding a class :php:`\MyVendor\MyExtension\Hook\BlindedConfigurationOptionsHook`: + +.. code-block:: php + + class BlindedConfigurationOptionsHook + { + /** + * Blind something in ConfigurationOptions + * + * @param array $blindedConfigurationOptions + * @return array + */ + public function modifyBlindedConfigurationOptions(array $blindedConfigurationOptions): array + { + if (!empty($GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS']['example']['password'])) { + $blindedConfigurationOptions['TYPO3_CONF_VARS']['EXTENSIONS']['example']['password'] = '******'; + } + + return $blindedConfigurationOptions; + } + } + +and adding the following line to ext_localconf.php: + +.. code-block:: php + + $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][\TYPO3\CMS\Lowlevel\Controller\ConfigurationController::class]['modifyBlindedConfigurationOptions'][] = \MyVendor\MyExtension\Hook\BlindedConfigurationOptionsHook::class; Impact ====== -- GitLab