Feature: #98426 - New PSR-14 event AfterRecordSummaryForLocalizationEvent
See forge#98426
Description
A new PSR-14 event
\TYPO3\
has been added to TYPO3 Core. This event is fired in the
\TYPO3\ class
and allows extensions to modify the payload of the
Json
in the
get method.
The event features the following methods:
get: Returns the currentColumns () $columnsarrayget: Returns the currentRecords () $recordsarrayset: Sets the currentColumns () $columnsarrayset: Sets the currentRecords () $recordsarray
Registration of the event in your extension's Services.:
MyVendor\MyPackage\EventListener\AfterRecordSummaryForLocalizationEventListener:
tags:
- name: event.listener
identifier: 'my-package/after-record-summary-for-localization-event-listener'
The corresponding event listener class:
use TYPO3\CMS\Backend\Controller\Event\AfterRecordSummaryForLocalizationEvent;
final class AfterRecordSummaryForLocalizationEventListener
{
public function __invoke(AfterRecordSummaryForLocalizationEvent $event): void
{
// Get current records
$records = $event->getRecords();
// Remove or add $records available for translation
// Set new records
$event->setRecords($records);
// Get current columns
$columns = $event->getColumns();
// Remove or add $columns available for translation
// Set new columns
$event->setColumns($columns);
}
}
Impact
The
get method is called in the translation process,
when displaying records and columns to translate.
It is now possible to use a new PSR-14 event that can modify the
$columns and
$records which are available for translation.