TYPO3 CMS  TYPO3_6-2
ContextMenuDataProvider.php
Go to the documentation of this file.
1 <?php
3 
18 
25 
33  protected $legacyContextMenuMapping = array(
34  'hide' => 'disable',
35  'paste' => 'pasteInto,pasteAfter',
36  'mount_as_treeroot' => 'mountAsTreeroot'
37  );
38 
44  protected function getDisableActions() {
45  $tsConfig = $GLOBALS['BE_USER']->getTSConfig('options.contextMenu.' . $this->getContextMenuType() . '.disableItems');
46  $disableItems = array();
47  if (trim($tsConfig['value']) !== '') {
48  $disableItems = GeneralUtility::trimExplode(',', $tsConfig['value']);
49  }
50  $tsConfig = $GLOBALS['BE_USER']->getTSConfig('options.contextMenu.pageTree.disableItems');
51  $oldDisableItems = array();
52  if (trim($tsConfig['value']) !== '') {
53  $oldDisableItems = GeneralUtility::trimExplode(',', $tsConfig['value']);
54  }
55  $additionalItems = array();
56  foreach ($oldDisableItems as $item) {
57  if (!isset($this->legacyContextMenuMapping[$item])) {
58  $additionalItems[] = $item;
59  continue;
60  }
61  if (strpos($this->legacyContextMenuMapping[$item], ',')) {
62  $actions = GeneralUtility::trimExplode(',', $this->legacyContextMenuMapping[$item]);
63  $additionalItems = array_merge($additionalItems, $actions);
64  } else {
65  $additionalItems[] = $item;
66  }
67  }
68  $disableItems = array_merge($disableItems, $additionalItems);
69 
70  // Further manipulation of disableItems array via hook
71  // @internal: This is an internal hook for extension impexp only, this hook may change without further notice
72  if (!empty($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['backend']['contextMenu']['disableItems'])
73  && is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['backend']['contextMenu']['disableItems'])
74  ) {
75  $hooks = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['backend']['contextMenu']['disableItems'];
76  foreach ($hooks as $hook) {
77  $parameterArray = array(
78  'disableItems' => &$disableItems,
79  );
80  $null = NULL;
81  GeneralUtility::callUserFunction($hook, $parameterArray, $null);
82  }
83  }
84 
85  return $disableItems;
86  }
87 
94  public function getActionsForNode(\TYPO3\CMS\Backend\Tree\TreeNode $node) {
95  $this->disableItems = $this->getDisableActions();
96  $configuration = $this->getConfiguration();
97  $contextMenuActions = array();
98  if (is_array($configuration)) {
99  $contextMenuActions = $this->getNextContextMenuLevel($configuration, $node);
100  }
101  return $contextMenuActions;
102  }
103 
104 }
static trimExplode($delim, $string, $removeEmptyValues=FALSE, $limit=0)
static callUserFunction($funcName, &$params, &$ref, $checkPrefix='', $errorMode=0)
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]