[TASK] Replace static calls to FlashMessageQueue to the new service
[Packages/TYPO3.CMS.git] / typo3 / sysext / workspaces / Classes / Controller / PreviewController.php
index 514d09f..aaeadd2 100644 (file)
@@ -178,8 +178,12 @@ class PreviewController extends \TYPO3\CMS\Workspaces\Controller\AbstractControl
         * @return void
         */
        public function newPageAction() {
-               $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', $GLOBALS['LANG']->sL('LLL:EXT:workspaces/Resources/Private/Language/locallang.xml:info.newpage.detail'), $GLOBALS['LANG']->sL('LLL:EXT:workspaces/Resources/Private/Language/locallang.xml:info.newpage'), \TYPO3\CMS\Core\Messaging\FlashMessage::INFO);
-               \TYPO3\CMS\Core\Messaging\FlashMessageQueue::addMessage($message);
+               $flashMessage = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', $GLOBALS['LANG']->sL('LLL:EXT:workspaces/Resources/Private/Language/locallang.xml:info.newpage.detail'), $GLOBALS['LANG']->sL('LLL:EXT:workspaces/Resources/Private/Language/locallang.xml:info.newpage'), \TYPO3\CMS\Core\Messaging\FlashMessage::INFO);
+               /** @var $flashMessageService \TYPO3\CMS\Core\Messaging\FlashMessageService */
+               $flashMessageService = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessageService');
+               /** @var $defaultFlashMessageQueue \TYPO3\CMS\Core\Messaging\FlashMessageQueue */
+               $defaultFlashMessageQueue = $flashMessageService->getMessageQueueByIdentifier();
+               $defaultFlashMessageQueue->enqueue($flashMessage);
        }
 
        /**