我想通过 PSR-14 事件侦听器注册替换旧的信号注册。所以我从我的 ext_localconf.php 中删除了以下内容:
ext_localconf.php
...
$signalSlotDispatcher = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\SignalSlot\Dispatcher::class);
$signalSlotDispatcher->connect(
\TYPO3\CMS\Extensionmanager\Utility\InstallUtility::class,
'afterExtensionInstall',
\My\Example\Slots\InstallUtility::class,
'afterExtensionInstall'
);
...
此外,我创建了以下文件:
配置/服务.yaml
services:
My\Example\Slots\InstallUtility:
tags:
- name: event.listener
identifier: 'afterExtensionInstall'
event: TYPO3\CMS\Core\Package\Event\AfterPackageActivationEvent
之后,我向 My\Example\Slots\InstallUtility 添加了一个调用函数:
namespace My\Example\Slots;
use TYPO3\CMS\Core\Package\Event\AfterPackageActivationEvent;
class InstallUtility
{
/**
* @param AfterPackageActivationEvent $event
*/
public function __invoke(AfterPackageActivationEvent $event): void
{
\TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump('event got triggered'); die();
}
...
}
但这不起作用。如果通过扩展管理器停用我的扩展,然后再次重新激活它,则不会发生任何事情。
我在这里错过了什么吗?