Skip to content

Commit

Permalink
[TASK] Migrate event listener registration of another couple of exten…
Browse files Browse the repository at this point in the history
…sions

Resolves: #101595
Related: #101585
Releases: main
Change-Id: I75edc68ba4d2bd967530cf3389d6dc944fe347b0
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/80411
Tested-by: Benni Mack <[email protected]>
Reviewed-by: Oliver Bartsch <[email protected]>
Reviewed-by: Stefan B�rk <[email protected]>
Reviewed-by: Benni Mack <[email protected]>
Tested-by: Stefan B�rk <[email protected]>
Tested-by: core-ci <[email protected]>
Tested-by: Oliver Bartsch <[email protected]>
  • Loading branch information
o-ba committed Aug 7, 2023
1 parent 516e7e2 commit f022bd4
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 41 deletions.
3 changes: 3 additions & 0 deletions Classes/EventListener/DataStructureIdentifierListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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();
Expand Down
2 changes: 2 additions & 0 deletions Classes/EventListener/ProcessFileListActionsEventListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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()) {
Expand Down
7 changes: 7 additions & 0 deletions Classes/Slot/FilePersistenceSlot.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -106,6 +107,7 @@ public function allowInvocation(
return true;
}

#[AsEventListener('form-framework/creation')]
public function onPreFileCreate(BeforeFileCreatedEvent $event): void
{
$combinedFileIdentifier = $this->buildCombinedIdentifier(
Expand All @@ -119,6 +121,7 @@ public function onPreFileCreate(BeforeFileCreatedEvent $event): void
);
}

#[AsEventListener('form-framework/add')]
public function onPreFileAdd(BeforeFileAddedEvent $event): void
{
$combinedFileIdentifier = $this->buildCombinedIdentifier(
Expand All @@ -138,6 +141,7 @@ public function onPreFileAdd(BeforeFileAddedEvent $event): void
);
}

#[AsEventListener('form-framework/rename')]
public function onPreFileRename(BeforeFileRenamedEvent $event): void
{
$combinedFileIdentifier = $this->buildCombinedIdentifier(
Expand All @@ -151,6 +155,7 @@ public function onPreFileRename(BeforeFileRenamedEvent $event): void
);
}

#[AsEventListener('form-framework/replace')]
public function onPreFileReplace(BeforeFileReplacedEvent $event): void
{
$combinedFileIdentifier = $this->buildCombinedIdentifier(
Expand All @@ -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
Expand All @@ -187,6 +193,7 @@ public function onPreFileMove(BeforeFileMovedEvent $event): void
);
}

#[AsEventListener('form-framework/update-content')]
public function onPreFileSetContents(BeforeFileContentsSetEvent $event): void
{
$combinedFileIdentifier = $this->buildCombinedIdentifier(
Expand Down
2 changes: 2 additions & 0 deletions Classes/Slot/ResourcePublicationSlot.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -39,6 +40,7 @@ class ResourcePublicationSlot implements SingletonInterface
*/
protected $fileIdentifiers = [];

#[AsEventListener('form-framework/resource-getPublicUrl')]
public function getPublicUrl(GeneratePublicUrlForResourceEvent $event): void
{
$resource = $event->getResource();
Expand Down
41 changes: 0 additions & 41 deletions Configuration/Services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f022bd4

Please sign in to comment.