diff --git a/typo3/sysext/backend/Classes/ContextMenu/AbstractContextMenuDataProvider.php b/typo3/sysext/backend/Classes/ContextMenu/AbstractContextMenuDataProvider.php index 8d0111114bbbfdfe186af3d79c4302ed172608b9..796826754d58072c2a1450651fc3e5a174c30de1 100644 --- a/typo3/sysext/backend/Classes/ContextMenu/AbstractContextMenuDataProvider.php +++ b/typo3/sysext/backend/Classes/ContextMenu/AbstractContextMenuDataProvider.php @@ -70,7 +70,7 @@ abstract class AbstractContextMenuDataProvider { * @return array */ protected function getConfiguration() { - $contextMenuActions = $GLOBALS['BE_USER']->getTSConfig('options.contextMenu.' . $this->contextMenuType . '.items'); + $contextMenuActions = $this->getBackendUser()->getTSConfig('options.contextMenu.' . $this->contextMenuType . '.items'); return $contextMenuActions['properties']; } @@ -176,7 +176,7 @@ abstract class AbstractContextMenuDataProvider { unset($action); continue; } - $label = $GLOBALS['LANG']->sL($actionConfiguration['label'], TRUE); + $label = $this->getLanguageService()->sL($actionConfiguration['label'], TRUE); if ($type === 'SUBMENU') { $action->setType('submenu'); $action->setChildActions($this->getNextContextMenuLevel($actionConfiguration, $node, $level + 1)); @@ -220,4 +220,22 @@ abstract class AbstractContextMenuDataProvider { return $contentUrl; } + /** + * Returns LanguageService + * + * @return \TYPO3\CMS\Lang\LanguageService + */ + protected function getLanguageService() { + return $GLOBALS['LANG']; + } + + /** + * Returns the current BE user. + * + * @return \TYPO3\CMS\Core\Authentication\BackendUserAuthentication + */ + protected function getBackendUser() { + return $GLOBALS['BE_USER']; + } + } diff --git a/typo3/sysext/backend/Classes/ContextMenu/Pagetree/ContextMenuDataProvider.php b/typo3/sysext/backend/Classes/ContextMenu/Pagetree/ContextMenuDataProvider.php index f252cc6202355c5c3162667a3f009d43acaea9e9..2883a4e9c78c620e646f3e3e9d8a264fc8fd46ba 100644 --- a/typo3/sysext/backend/Classes/ContextMenu/Pagetree/ContextMenuDataProvider.php +++ b/typo3/sysext/backend/Classes/ContextMenu/Pagetree/ContextMenuDataProvider.php @@ -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']; + } + }