[TASK] Replace static calls to FlashMessageQueue to the new service
authorWouter Wolters <typo3@wouterwolters.nl>
Sat, 23 Mar 2013 16:00:49 +0000 (17:00 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Fri, 29 Mar 2013 10:28:36 +0000 (11:28 +0100)
Change-Id: I2f7c470ba0aa6086989b5bd38be1f9cfdcc77650
Resolves: #46607
Related: #44593
Releases: 6.1
Reviewed-on: https://review.typo3.org/19227
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
typo3/sysext/workspaces/Classes/Controller/PreviewController.php
typo3/sysext/workspaces/Classes/Controller/ReviewController.php
typo3/sysext/workspaces/Classes/Hook/BackendUtilityHook.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);
        }
 
        /**
index 6d5e0ad..adbac30 100644 (file)
@@ -129,8 +129,12 @@ class ReviewController extends \TYPO3\CMS\Workspaces\Controller\AbstractControll
                parent::initializeAction();
                $this->template->setExtDirectStateProvider();
                if (\TYPO3\CMS\Workspaces\Service\WorkspaceService::isOldStyleWorkspaceUsed()) {
-                       $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', $GLOBALS['LANG']->sL('LLL:EXT:workspaces/Resources/Private/Language/locallang.xml:warning.oldStyleWorkspaceInUser'), '', \TYPO3\CMS\Core\Messaging\FlashMessage::WARNING);
-                       \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:warning.oldStyleWorkspaceInUser'), '', \TYPO3\CMS\Core\Messaging\FlashMessage::WARNING);
+                       /** @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);
                }
                $this->pageRenderer->loadExtJS();
                $this->pageRenderer->enableExtJSQuickTips();
index f06825d..ec4f8cf 100644 (file)
@@ -87,7 +87,11 @@ class BackendUtilityHook implements \TYPO3\CMS\Core\SingletonInterface {
                                $editingName = $stages->getStageTitle(\TYPO3\CMS\Workspaces\Service\StagesService::STAGE_EDIT_ID);
                                $message = $GLOBALS['LANG']->sL('LLL:EXT:workspaces/Resources/Private/Language/locallang.xlf:info.elementAlreadyModified');
                                $flashMessage = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', sprintf($message, $stageName, $editingName), '', \TYPO3\CMS\Core\Messaging\FlashMessage::INFO, TRUE);
-                               \TYPO3\CMS\Core\Messaging\FlashMessageQueue::addMessage($flashMessage);
+                               /** @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);
                        }
                }
                return $params['hasAccess'];