ModifyBlindedConfigurationOptionsEvent
New in version 12.2
The event serves as a direct replacement for the deprecated hook
$GLOBALS
.
The PSR-14 event \TYPO3\
is fired in the \TYPO3\
and the \TYPO3\
while building the configuration array to be displayed in the
System > Configuration module. It allows to blind (hide) any
configuration options. Usually such options are passwords or other sensitive
information.
Using the get
method of the event, listeners are able
to determine the context the event got dispatched in. This is useful to prevent
duplicate code execution, since the event is dispatched for multiple providers.
The method returns the identifier of the configuration provider as registered
in the configuration module.
Example
<?php
declare(strict_types=1);
namespace MyVendor\MyExtension\Lowlevel\EventListener;
use TYPO3\CMS\Core\Attribute\AsEventListener;
use TYPO3\CMS\Lowlevel\Event\ModifyBlindedConfigurationOptionsEvent;
#[AsEventListener(
identifier: 'my-extension/blind-configuration-options',
)]
final readonly class MyEventListener
{
public function __invoke(ModifyBlindedConfigurationOptionsEvent $event): void
{
$options = $event->getBlindedConfigurationOptions();
if ($event->getProviderIdentifier() === 'sitesYamlConfiguration') {
$options['my-site']['settings']['apiKey'] = '***';
} elseif ($event->getProviderIdentifier() === 'confVars') {
$options['TYPO3_CONF_VARS']['EXTENSIONS']['my_extension']['password'] = '***';
}
$event->setBlindedConfigurationOptions($options);
}
}
New in version 13.0
The PHP attribute \TYPO3\
has been
introduced to tag a PHP class as an event listener. Alternatively, or if you
need to be compatible with older TYPO3 versions, you can also register an
event listener via the Configuration/
file. Switch to
an older version of this page for an example or have a look at the section
Implementing an event listener in your extension.
API
- class ModifyBlindedConfigurationOptionsEvent
-
- Fully qualified name
-
\TYPO3\
CMS\ Lowlevel\ Event\ Modify Blinded Configuration Options Event
Listeners to this Event will be able to modify the blinded configuration options, displayed in the configuration module of the TYPO3 backend.