Feature: #107003 - Add event to change record data in list view
See forge#107003
Description
A new PSR-14 event
\TYPO3\
has been added. This event is dispatched in
Database and allows
extensions to modify the data used to render a single record in the list
view.
The event allows the following properties to be modified:
-
data: The row fields as an array. The following fields are available:_SELECTOR_: The checkbox elementicon: The icon__: Special field that contains the headerlabel _CONTROL_: The row action buttons_LOCALIZATION_: The current language_LOCALIZATION_: The translated languageb row: The row descriptionDescription header: The header. This field is used only if__is not set. Uselabel __instead.label uid: The record UID (read-only)
-
tag: The HTML tag attributes of the row. The following attributes are available:Attributes classdata-table title
The corresponding event listener class:
use TYPO3\CMS\Backend\RecordList\Event\AfterRecordListRowPreparedEvent;
use TYPO3\CMS\Core\Attribute\AsEventListener;
#[AsEventListener('my-package/backend/my-listener-name')]
final class MyEventListener
{
public function __invoke(AfterRecordListRowPreparedEvent $event): void
{
$data = $event->getData();
$tagAttributes = $event->getTagAttributes();
// Modify the row data and tag attributes here.
$event->setData($data);
$event->setTagAttributes($tagAttributes);
}
}
Copied!
Impact
The new PSR-14 event can be used, for example, to modify the title link in the record list.