Commit 497e07c5 authored by Michael Oehlhof's avatar Michael Oehlhof Committed by Wouter Wolters
Browse files

[TASK] Introduced getter for $GLOBALS in backend/Classes/ContextMenu

- add getter for LanguageService
- add getter for BackendUser

Resolves: #65445
Releases: master
Change-Id: I985f9b0aa619ea7f90f35fe169122c26850a73df
Reviewed-on: http://review.typo3.org/37444


Reviewed-by: default avatarMarkus Klein <klein.t3@reelworx.at>
Tested-by: default avatarMarkus Klein <klein.t3@reelworx.at>
Reviewed-by: Wouter Wolters's avatarWouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters's avatarWouter Wolters <typo3@wouterwolters.nl>
parent b306a170
......@@ -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'];
}
}
......@@ -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'];
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment