Feature: #99430 - Add event after record publishing in workspaces

See forge#99430

Description

A new PSR-14 event \TYPO3\CMS\Workspaces\Event\AfterRecordPublishedEvent has been added to allow extension developers to react on record publishing in workspaces.

The new event is fired after a record has been published in a workspace and provides the following methods:

  • getTable(): The record's table name
  • getRecordId(): The record's UID
  • getWorkspaceId(): The workspace the record has been published in

Example

Registration of the AfterRecordPublishedEvent in your extension's Services.yaml:

EXT:my_extension/Configuration/Services.yaml
MyVendor\MyExtension\Workspaces\MyEventListener:
  tags:
    - name: event.listener
      identifier: 'my-extension/after-record-published'
Copied!

The corresponding event listener class:

EXT:my_extension/Classes/Workspaces/MyEventListener.php
namespace MyVendor\MyExtension\Workspaces;

use TYPO3\CMS\Workspaces\Event\AfterRecordPublishedEvent;

final class MyEventListener {
    public function __invoke(AfterRecordPublishedEvent $event): void
    {
        // Do your magic here
    }
}
Copied!

Impact

With the new PSR-14 event AfterRecordPublishedEvent it is possible to execute custom functionality after a record has been published in a workspace.