Feature: #83740 - Cleanup of AbstractRecordList breaks hook

See forge#83740

Description

A new hook in DatabaseRecordList and PageLayoutView allows modify the current database query.

Register the hook via

  • php:$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][\TYPO3\CMS\Recordlist\RecordList\DatabaseRecordList::class]['modifyQuery']

  • php:$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][\TYPO3\CMS\Backend\View\PageLayoutView::class]['modifyQuery']

in the extensions ext_localconf.php file.

Example

An example implementation could look like this:

EXT:my_site/ext_localconf.php

$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][\TYPO3\CMS\Recordlist\RecordList\DatabaseRecordList::class]['modifyQuery'][1313131313] =
   \MyVendor\MySite\Hooks\DatabaseRecordListHook::class . '->modifyQuery';

EXT:my_site/Classes/Hooks/DatabaseRecordListHook.php

namespace MyVendor\MySite\Hooks;

class DatabaseRecordListHook
{
   public function modifyQuery(
      array $parameters,
      string $table,
      int $pageId,
      array $additionalConstraints,
      array $fieldList,
      \TYPO3\CMS\Core\Database\Query\QueryBuilder $queryBuilder
   ) {
      // modify $queryBuilder
   }
}