[BUGFIX] Recordlist: Removed call to deprecated method render() 71/46671/2
authorMichael Oehlhof <typo3@oehlhof.de>
Sat, 13 Feb 2016 13:52:02 +0000 (14:52 +0100)
committerFrank Naegler <frank.naegler@typo3.org>
Mon, 15 Feb 2016 16:02:29 +0000 (17:02 +0100)
Call of FlashMessage->render() if no records are on the page
was replaced with appropriate code.

Resolves: #73421
Releases: master, 7.6
Change-Id: If10a5a0ec4f71df6008369c83a9ab6a56c812d4e
Reviewed-on: https://review.typo3.org/46671
Reviewed-by: Frank Naegler <frank.naegler@typo3.org>
Tested-by: Frank Naegler <frank.naegler@typo3.org>
typo3/sysext/recordlist/Classes/RecordList.php

index f6b56d7..26a26d5 100644 (file)
@@ -27,6 +27,7 @@ use TYPO3\CMS\Core\DataHandling\DataHandler;
 use TYPO3\CMS\Core\Imaging\Icon;
 use TYPO3\CMS\Core\Imaging\IconFactory;
 use TYPO3\CMS\Core\Messaging\FlashMessage;
+use TYPO3\CMS\Core\Messaging\FlashMessageService;
 use TYPO3\CMS\Core\Page\PageRenderer;
 use TYPO3\CMS\Core\Type\Bitmask\Permission;
 use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
@@ -482,12 +483,18 @@ class RecordList extends AbstractModule
         if (!empty($dblist->HTMLcode)) {
             $output = $dblist->HTMLcode;
         } else {
-            $output = $flashMessage = GeneralUtility::makeInstance(
+            $output = '';
+            $flashMessage = GeneralUtility::makeInstance(
                 FlashMessage::class,
                 $lang->getLL('noRecordsOnThisPage'),
                 '',
                 FlashMessage::INFO
-            )->render();
+            );
+            /** @var $flashMessageService \TYPO3\CMS\Core\Messaging\FlashMessageService */
+            $flashMessageService = GeneralUtility::makeInstance(FlashMessageService::class);
+            /** @var $defaultFlashMessageQueue \TYPO3\CMS\Core\Messaging\FlashMessageQueue */
+            $defaultFlashMessageQueue = $flashMessageService->getMessageQueueByIdentifier();
+            $defaultFlashMessageQueue->enqueue($flashMessage);
         }
 
         $this->body .= '<form action="' . htmlspecialchars($dblist->listURL()) . '" method="post" name="dblistForm">';