Attention
TYPO3 v12 has reached end-of-life as of April 30th 2026 and is no longer being maintained. Use the version switcher on the top left of this page to select documentation for a supported version of TYPO3.
Need more time before upgrading? You can purchase Extended Long Term Support (ELTS) for TYPO3 v12 here: TYPO3 ELTS.
ModifyDatabaseQueryForRecordListingEvent
New in version 12.0
This event has been introduced to replace the following removed hooks:
$GLOBALS['TYPO3_ CONF_ VARS'] ['SC_ OPTIONS'] ['typo3/ class. db_ list_ extra. inc'] ['get Table'] $GLOBALS['TYPO3_ CONF_ VARS'] ['SC_ OPTIONS'] ['TYPO3\ CMS\ Recordlist\ Record List\ Database Record List'] ['modify Query'] $GLOBALS['TYPO3_ CONF_ VARS'] ['SC_ OPTIONS'] ['TYPO3\ CMS\ Recordlist\ Record List\ Database Record List'] ['make Search String Constraints']
The PSR-14 event
\TYPO3\
allows to alter the query builder SQL
statement before a list of records is rendered in record lists, such as
the List module or an element browser.
Example
Registration of the event listener in the extension's Services.:
services:
# Place here the default dependency injection configuration
MyVendor\MyExtension\Backend\EventListener\MyEventListener:
tags:
- name: event.listener
identifier: 'my-extension/backend/modify-database-query-for-record-list'
Read how to configure dependency injection in extensions.
The corresponding event listener class:
<?php
declare(strict_types=1);
namespace MyVendor\MyExtension\Backend\EventListener;
use TYPO3\CMS\Backend\View\Event\ModifyDatabaseQueryForRecordListingEvent;
final class MyEventListener
{
public function __invoke(ModifyDatabaseQueryForRecordListingEvent $event): void
{
$queryBuilder = $event->getQueryBuilder();
// ... do something ...
$event->setQueryBuilder($queryBuilder);
}
}
API
- class ModifyDatabaseQueryForRecordListingEvent
-
- Fully qualified name
-
\TYPO3\
CMS\ Backend\ View\ Event\ Modify Database Query For Record Listing Event
Use this Event to alter the database query when loading content for a page (usually in the list module) before it is executed.