From b99a67c2fc5b5c2122f42f6fadc997e07282c91c Mon Sep 17 00:00:00 2001
From: Wouter Wolters <typo3@wouterwolters.nl>
Date: Fri, 20 Jun 2014 20:28:14 +0200
Subject: [PATCH] [BUGFIX] getAvailableWorkspaces called statically

Use same call to getAvailableWorkspaces as in
checkAccess.

Resolves: #51420
Releases: 6.3, 6.2
Change-Id: Icbea4611d7bd498e25bf658d7f3fa5a74539f479
Reviewed-on: https://review.typo3.org/30962
Reviewed-by: Oliver Klee
Reviewed-by: Robert van Kammen
Tested-by: Robert van Kammen
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
---
 .../Classes/ExtDirect/WorkspaceSelectorToolbarItem.php      | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/typo3/sysext/workspaces/Classes/ExtDirect/WorkspaceSelectorToolbarItem.php b/typo3/sysext/workspaces/Classes/ExtDirect/WorkspaceSelectorToolbarItem.php
index 058bf570edce..48f46ec77941 100644
--- a/typo3/sysext/workspaces/Classes/ExtDirect/WorkspaceSelectorToolbarItem.php
+++ b/typo3/sysext/workspaces/Classes/ExtDirect/WorkspaceSelectorToolbarItem.php
@@ -98,7 +98,9 @@ class WorkspaceSelectorToolbarItem implements \TYPO3\CMS\Backend\Toolbar\Toolbar
 		$this->addJavascriptToBackend();
 
 		$index = 0;
-		$availableWorkspaces = \TYPO3\CMS\Workspaces\Service\WorkspaceService::getAvailableWorkspaces();
+		/** @var \TYPO3\CMS\Workspaces\Service\WorkspaceService $wsService */
+		$wsService = GeneralUtility::makeInstance('TYPO3\\CMS\\Workspaces\\Service\\WorkspaceService');
+		$availableWorkspaces = $wsService->getAvailableWorkspaces();
 		$activeWorkspace = (int)$GLOBALS['BE_USER']->workspace;
 		$stateCheckedIcon = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('status-status-checked');
 		$stateUncheckedIcon = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('empty-empty', array(
@@ -167,4 +169,4 @@ class WorkspaceSelectorToolbarItem implements \TYPO3\CMS\Backend\Toolbar\Toolbar
 
 if (!(TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_AJAX)) {
 	$GLOBALS['TYPO3backend']->addToolbarItem('workSpaceSelector', 'TYPO3\\CMS\\Workspaces\\ExtDirect\\WorkspaceSelectorToolbarItem');
-}
\ No newline at end of file
+}
-- 
GitLab