[BUGFIX] Function menu: Removed call to deprecated method render() 70/46670/2
authorMichael Oehlhof <typo3@oehlhof.de>
Wed, 10 Feb 2016 22:12:39 +0000 (23:12 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Mon, 15 Feb 2016 15:57:28 +0000 (16:57 +0100)
Call of FlashMessage->render() if no modules have been registered
was replaced with appropriate code.

Resolves: #73221
Releases: master, 7.6
Change-Id: I982e2d7d5b677e77a7f170a505f426780ac77089
Reviewed-on: https://review.typo3.org/46670
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/backend/Classes/Module/BaseScriptClass.php

index fb57913..fa4e970 100644 (file)
@@ -18,6 +18,7 @@ use TYPO3\CMS\Backend\Utility\BackendUtility;
 use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
 use TYPO3\CMS\Core\Database\DatabaseConnection;
 use TYPO3\CMS\Core\Messaging\FlashMessage;
+use TYPO3\CMS\Core\Messaging\FlashMessageService;
 use TYPO3\CMS\Core\Page\PageRenderer;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Lang\LanguageService;
@@ -346,7 +347,11 @@ class BaseScriptClass
                 $this->getLanguageService()->getLL('title'),
                 FlashMessage::ERROR
             );
-            $this->content .= $flashMessage->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);
         } else {
             $this->extObj->pObj = $this;
             if (is_callable(array($this->extObj, 'main'))) {