diff --git a/Classes/EventListener/DataStructureIdentifierListener.php b/Classes/EventListener/DataStructureIdentifierListener.php index 43089920..6251e157 100644 --- a/Classes/EventListener/DataStructureIdentifierListener.php +++ b/Classes/EventListener/DataStructureIdentifierListener.php @@ -17,6 +17,7 @@ namespace TYPO3\CMS\Form\EventListener; +use TYPO3\CMS\Core\Attribute\AsEventListener; use TYPO3\CMS\Core\Configuration\Event\AfterFlexFormDataStructureIdentifierInitializedEvent; use TYPO3\CMS\Core\Configuration\Event\AfterFlexFormDataStructureParsedEvent; use TYPO3\CMS\Core\Localization\LanguageService; @@ -51,6 +52,7 @@ class DataStructureIdentifierListener * and if the field "overrideFinishers" is active. Add both to the identifier to * hand these information over to parseDataStructureByIdentifierPostProcess() hook. */ + #[AsEventListener('form-framework/modify-data-structure-identifier')] public function modifyDataStructureIdentifier(AfterFlexFormDataStructureIdentifierInitializedEvent $event): void { $row = $event->getRow(); @@ -90,6 +92,7 @@ public function modifyDataStructureIdentifier(AfterFlexFormDataStructureIdentifi * Adds the list of existing form definitions to the form selection drop down * and adds sheets to override finisher settings if requested. */ + #[AsEventListener('form-framework/modify-data-structure')] public function modifyDataStructure(AfterFlexFormDataStructureParsedEvent $event): void { $identifier = $event->getIdentifier(); diff --git a/Classes/EventListener/ProcessFileListActionsEventListener.php b/Classes/EventListener/ProcessFileListActionsEventListener.php index 55f5382b..4788c31f 100644 --- a/Classes/EventListener/ProcessFileListActionsEventListener.php +++ b/Classes/EventListener/ProcessFileListActionsEventListener.php @@ -17,6 +17,7 @@ namespace TYPO3\CMS\Form\EventListener; +use TYPO3\CMS\Core\Attribute\AsEventListener; use TYPO3\CMS\Filelist\Event\ProcessFileListActionsEvent; use TYPO3\CMS\Form\Mvc\Persistence\FormPersistenceManager; @@ -28,6 +29,7 @@ class ProcessFileListActionsEventListener { protected const DISABLED_ACTIONS = ['edit', 'view', 'replace', 'rename', 'download']; + #[AsEventListener('form-framework/form-definition-files')] public function __invoke(ProcessFileListActionsEvent $event): void { if (!$event->isFile()) { diff --git a/Classes/Slot/FilePersistenceSlot.php b/Classes/Slot/FilePersistenceSlot.php index 8251c72c..6a8803d1 100644 --- a/Classes/Slot/FilePersistenceSlot.php +++ b/Classes/Slot/FilePersistenceSlot.php @@ -17,6 +17,7 @@ namespace TYPO3\CMS\Form\Slot; +use TYPO3\CMS\Core\Attribute\AsEventListener; use TYPO3\CMS\Core\Resource\Event\BeforeFileAddedEvent; use TYPO3\CMS\Core\Resource\Event\BeforeFileContentsSetEvent; use TYPO3\CMS\Core\Resource\Event\BeforeFileCreatedEvent; @@ -106,6 +107,7 @@ public function allowInvocation( return true; } + #[AsEventListener('form-framework/creation')] public function onPreFileCreate(BeforeFileCreatedEvent $event): void { $combinedFileIdentifier = $this->buildCombinedIdentifier( @@ -119,6 +121,7 @@ public function onPreFileCreate(BeforeFileCreatedEvent $event): void ); } + #[AsEventListener('form-framework/add')] public function onPreFileAdd(BeforeFileAddedEvent $event): void { $combinedFileIdentifier = $this->buildCombinedIdentifier( @@ -138,6 +141,7 @@ public function onPreFileAdd(BeforeFileAddedEvent $event): void ); } + #[AsEventListener('form-framework/rename')] public function onPreFileRename(BeforeFileRenamedEvent $event): void { $combinedFileIdentifier = $this->buildCombinedIdentifier( @@ -151,6 +155,7 @@ public function onPreFileRename(BeforeFileRenamedEvent $event): void ); } + #[AsEventListener('form-framework/replace')] public function onPreFileReplace(BeforeFileReplacedEvent $event): void { $combinedFileIdentifier = $this->buildCombinedIdentifier( @@ -164,6 +169,7 @@ public function onPreFileReplace(BeforeFileReplacedEvent $event): void ); } + #[AsEventListener('form-framework/move')] public function onPreFileMove(BeforeFileMovedEvent $event): void { // Skip check, in case file extension would not change during this @@ -187,6 +193,7 @@ public function onPreFileMove(BeforeFileMovedEvent $event): void ); } + #[AsEventListener('form-framework/update-content')] public function onPreFileSetContents(BeforeFileContentsSetEvent $event): void { $combinedFileIdentifier = $this->buildCombinedIdentifier( diff --git a/Classes/Slot/ResourcePublicationSlot.php b/Classes/Slot/ResourcePublicationSlot.php index 74813391..9dd9413b 100644 --- a/Classes/Slot/ResourcePublicationSlot.php +++ b/Classes/Slot/ResourcePublicationSlot.php @@ -17,6 +17,7 @@ namespace TYPO3\CMS\Form\Slot; +use TYPO3\CMS\Core\Attribute\AsEventListener; use TYPO3\CMS\Core\Core\Environment; use TYPO3\CMS\Core\Resource\Event\GeneratePublicUrlForResourceEvent; use TYPO3\CMS\Core\Resource\File; @@ -39,6 +40,7 @@ class ResourcePublicationSlot implements SingletonInterface */ protected $fileIdentifiers = []; + #[AsEventListener('form-framework/resource-getPublicUrl')] public function getPublicUrl(GeneratePublicUrlForResourceEvent $event): void { $resource = $event->getResource(); diff --git a/Configuration/Services.yaml b/Configuration/Services.yaml index fa400a2d..be1eda81 100644 --- a/Configuration/Services.yaml +++ b/Configuration/Services.yaml @@ -43,47 +43,6 @@ services: TYPO3\CMS\Form\Mvc\Property\PropertyMappingConfiguration: public: true - TYPO3\CMS\Form\Slot\ResourcePublicationSlot: - tags: - - name: event.listener - identifier: 'form-framework/resource-getPublicUrl' - method: 'getPublicUrl' - - TYPO3\CMS\Form\Slot\FilePersistenceSlot: - tags: - - name: event.listener - identifier: 'form-framework/creation' - method: 'onPreFileCreate' - - name: event.listener - identifier: 'form-framework/add' - method: 'onPreFileAdd' - - name: event.listener - identifier: 'form-framework/rename' - method: 'onPreFileRename' - - name: event.listener - identifier: 'form-framework/replace' - method: 'onPreFileReplace' - - name: event.listener - identifier: 'form-framework/move' - method: 'onPreFileMove' - - name: event.listener - identifier: 'form-framework/update-content' - method: 'onPreFileSetContents' - - TYPO3\CMS\Form\EventListener\ProcessFileListActionsEventListener: - tags: - - name: event.listener - identifier: 'form-framework/form-definition-files' - - TYPO3\CMS\Form\EventListener\DataStructureIdentifierListener: - tags: - - name: event.listener - identifier: 'form-framework/modify-data-structure-identifier' - method: 'modifyDataStructureIdentifier' - - name: event.listener - identifier: 'form-framework/modify-data-structure' - method: 'modifyDataStructure' - TYPO3\CMS\Form\SoftReference\FormPersistenceIdentifierSoftReferenceParser: tags: - name: softreference.parser