Feature #88985
closedAdd more descriptive message than "There are no records on this page" on a page with more record types
100%
Description
Having a page with multiple records of different types (say ext:news, together with tt_content) and you delete all items of any record type, the information message you get from \TYPO3\CMS\Recordlist\Controller\RecordListController::main is "There are no records on this page"
$flashMessage = GeneralUtility::makeInstance(
FlashMessage::class,
$lang->getLL('noRecordsOnThisPage'),
'',
FlashMessage::INFO
);
/** @var \TYPO3\CMS\Core\Messaging\FlashMessageService $flashMessageService */
$flashMessageService = GeneralUtility::makeInstance(FlashMessageService::class);
/** @var \TYPO3\CMS\Core\Messaging\FlashMessageQueue $defaultFlashMessageQueue */
$defaultFlashMessageQueue = $flashMessageService->getMessageQueueByIdentifier();
$defaultFlashMessageQueue->enqueue($flashMessage);
Since this page may have more records of other types that message is not really true. (It does not have records of type %s any more)
In \TYPO3\CMS\Recordlist\RecordList\DatabaseRecordList::generateList the htmlCode gets generated and checked of course only for this table you currently selected is having any records. The result is null, and therefore the information text is displayed.
Steps to reproduce:
1) Create page and create multiple records of different record types (example ext:news and normal content elements living in tt_content)
2) In Web->List view select you want to see only records of type X
3) Delete all records (via clipboard manager or deleted one by one)
4) You will see the information message "There are no records on this page"
Debugging:
Use GeneralUtility::_GP('table') to get the wanted table name, normalize it (somehow) and printf it to the information message.
Or \TYPO3\CMS\Recordlist\RecordList\DatabaseRecordList::generateList knows the wanted tablename(s), too.
// Checking if the table should be rendered:
// Checks that we see only permitted/requested tables:
if ($this->table && $tableName !== $this->table
|| $this->tableList && !GeneralUtility::inList($this->tableList, $tableName)
|| !$backendUser->check('tables_select', $tableName)
) {
$hideTable = true;
}