2 namespace TYPO3\CMS\Backend\ContextMenu;
78 $contextMenuActions = $this->
getBackendUser()->getTSConfig(
'options.contextMenu.' . $this->contextMenuType .
'.items');
79 return $contextMenuActions[
'properties'];
96 if ($displayCondition ===
'') {
100 $conditions = array();
101 preg_match_all(
'/(.+?)(>=|<=|!=|=|>|<)(.+?)(\\|\\||&&|$)/is', $displayCondition, $conditions);
104 $amountOfConditions = count($conditions[0]);
105 for ($i = 0; $i < $amountOfConditions; ++$i) {
107 $method = trim($conditions[1][$i]);
108 list($method, $index) = explode(
'|', $method);
109 if (!method_exists($node, $method)) {
113 $returnValue = call_user_func(array($node, $method));
114 if (is_array($returnValue)) {
115 $returnValue = $returnValue[$index];
118 $operator = trim($conditions[2][$i]);
119 $expected = trim($conditions[3][$i]);
120 if ($operator ===
'=') {
121 $returnValue = $returnValue == $expected;
122 }
elseif ($operator ===
'>') {
123 $returnValue = $returnValue > $expected;
124 }
elseif ($operator ===
'<') {
125 $returnValue = $returnValue < $expected;
126 }
elseif ($operator ===
'>=') {
127 $returnValue = $returnValue >= $expected;
128 }
elseif ($operator ===
'<=') {
129 $returnValue = $returnValue <= $expected;
130 }
elseif ($operator ===
'!=') {
131 $returnValue = $returnValue != $expected;
133 $returnValue =
false;
137 if ($chainType ===
'||') {
138 $lastResult = $lastResult || $returnValue;
139 }
elseif ($chainType ===
'&&') {
140 $lastResult = $lastResult && $returnValue;
142 $lastResult = $returnValue;
145 $chainType = trim($conditions[4][$i]);
158 protected function getNextContextMenuLevel(array $actions,
TreeNode $node, $level = 0)
165 return $actionCollection;
168 foreach ($actions as $index => $actionConfiguration) {
169 if (substr($index, -1) !==
'.') {
170 $type = $actionConfiguration;
171 if ($type !==
'DIVIDER') {
175 if (!in_array($type, array(
'DIVIDER',
'SUBMENU',
'ITEM'))) {
180 $action->setId($index);
181 if ($type ===
'DIVIDER') {
182 $action->setType(
'divider');
184 if (in_array($actionConfiguration[
'name'], $this->disableItems) || isset($actionConfiguration[
'displayCondition']) && trim($actionConfiguration[
'displayCondition']) !==
'' && !$this->
evaluateDisplayCondition($node, $actionConfiguration[
'displayCondition'])) {
189 if ($type ===
'SUBMENU') {
190 $action->setType(
'submenu');
191 $action->setChildActions($this->getNextContextMenuLevel($actionConfiguration, $node, $level + 1));
193 $action->setType(
'action');
194 $action->setCallbackAction($actionConfiguration[
'callbackAction']);
195 if (is_array($actionConfiguration[
'customAttributes.'])) {
196 if (!empty($actionConfiguration[
'customAttributes.'][
'contentUrl'])) {
197 $actionConfiguration[
'customAttributes.'][
'contentUrl'] = $this->
replaceModuleTokenInContentUrl($actionConfiguration[
'customAttributes.'][
'contentUrl']);
199 $action->setCustomAttributes($actionConfiguration[
'customAttributes.']);
202 $action->setLabel($label);
203 if (!isset($actionConfiguration[
'iconName'])) {
204 $actionConfiguration[
'iconName'] =
'miscellaneous-placeholder';
206 $action->setIcon($iconFactory->getIcon($actionConfiguration[
'iconName'],
Icon::SIZE_SMALL)->render());
208 $actionCollection->offsetSet($level . (
int)$index, $action);
209 $actionCollection->ksort();
211 return $actionCollection;
222 $parsedUrl = parse_url($contentUrl);
223 parse_str($parsedUrl[
'query'], $urlParameters);
224 if (isset($urlParameters[
'M'])) {
225 $moduleName = $urlParameters[
'M'];
226 unset($urlParameters[
'M']);
227 $contentUrl = BackendUtility::getModuleUrl($moduleName, $urlParameters);