‪TYPO3CMS  10.4
ContextMenuController.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
20 use Psr\Http\Message\ResponseInterface;
21 use Psr\Http\Message\ServerRequestInterface;
27 
33 {
37  public function ‪__construct()
38  {
39  $this->‪getLanguageService()->‪includeLLFile('EXT:core/Resources/Private/Language/locallang_misc.xlf');
40  }
41 
48  public function ‪getContextMenuAction(ServerRequestInterface $request): ResponseInterface
49  {
50  $contextMenu = GeneralUtility::makeInstance(ContextMenu::class);
51 
52  $params = $request->getQueryParams();
53  $context = $params['context'] ?? '';
54  $items = $contextMenu->getItems($params['table'], $params['uid'], $context);
55  if (!is_array($items)) {
56  $items = [];
57  }
58  return (new ‪JsonResponse())->setPayload($items);
59  }
60 
65  public function ‪clipboardAction(ServerRequestInterface $request): ResponseInterface
66  {
68  $clipboard = GeneralUtility::makeInstance(Clipboard::class);
69  $clipboard->initializeClipboard();
70  $clipboard->lockToNormal();
71 
72  $clipboard->setCmd($request->getQueryParams()['CB']);
73  $clipboard->cleanCurrent();
74 
75  $clipboard->endClipboard();
76  return (new ‪JsonResponse())->setPayload([]);
77  }
78 
85  {
86  return ‪$GLOBALS['LANG'];
87  }
88 }
‪TYPO3\CMS\Core\Localization\LanguageService\includeLLFile
‪array includeLLFile($fileRef, $setGlobal=null, $mergeLocalOntoDefault=null)
Definition: LanguageService.php:297
‪TYPO3\CMS\Backend\Clipboard\Clipboard
Definition: Clipboard.php:43
‪TYPO3\CMS\Backend\Controller\ContextMenuController\__construct
‪__construct()
Definition: ContextMenuController.php:37
‪TYPO3\CMS\Backend\Controller\ContextMenuController\clipboardAction
‪ResponseInterface clipboardAction(ServerRequestInterface $request)
Definition: ContextMenuController.php:65
‪TYPO3\CMS\Backend\Controller\ContextMenuController\getLanguageService
‪LanguageService getLanguageService()
Definition: ContextMenuController.php:84
‪TYPO3\CMS\Backend\ContextMenu\ContextMenu
Definition: ContextMenu.php:29
‪TYPO3\CMS\Backend\Controller\ContextMenuController\getContextMenuAction
‪ResponseInterface getContextMenuAction(ServerRequestInterface $request)
Definition: ContextMenuController.php:48
‪TYPO3\CMS\Core\Http\JsonResponse
Definition: JsonResponse.php:26
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:5
‪TYPO3\CMS\Core\Localization\LanguageService
Definition: LanguageService.php:42
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:46
‪TYPO3\CMS\Backend\Controller
Definition: AbstractFormEngineAjaxController.php:18
‪TYPO3\CMS\Backend\Controller\ContextMenuController
Definition: ContextMenuController.php:33