[TASK] Introduced getter for $GLOBALS in backend/Classes/ContextMenu
[Packages/TYPO3.CMS.git] / typo3 / sysext / backend / Classes / ContextMenu / Pagetree / ContextMenuDataProvider.php
index f252cc6..2883a4e 100644 (file)
@@ -42,12 +42,12 @@ class ContextMenuDataProvider extends \TYPO3\CMS\Backend\ContextMenu\AbstractCon
         * @return array
         */
        protected function getDisableActions() {
-               $tsConfig = $GLOBALS['BE_USER']->getTSConfig('options.contextMenu.' . $this->getContextMenuType() . '.disableItems');
+               $tsConfig = $this->getBackendUser()->getTSConfig('options.contextMenu.' . $this->getContextMenuType() . '.disableItems');
                $disableItems = array();
                if (trim($tsConfig['value']) !== '') {
                        $disableItems = GeneralUtility::trimExplode(',', $tsConfig['value']);
                }
-               $tsConfig = $GLOBALS['BE_USER']->getTSConfig('options.contextMenu.pageTree.disableItems');
+               $tsConfig = $this->getBackendUser()->getTSConfig('options.contextMenu.pageTree.disableItems');
                $oldDisableItems = array();
                if (trim($tsConfig['value']) !== '') {
                        $oldDisableItems = GeneralUtility::trimExplode(',', $tsConfig['value']);
@@ -84,4 +84,13 @@ class ContextMenuDataProvider extends \TYPO3\CMS\Backend\ContextMenu\AbstractCon
                return $contextMenuActions;
        }
 
+       /**
+        * Returns the current BE user.
+        *
+        * @return \TYPO3\CMS\Core\Authentication\BackendUserAuthentication
+        */
+       protected function getBackendUser() {
+               return $GLOBALS['BE_USER'];
+       }
+
 }