‪TYPO3CMS  9.5
ContextMenuController.php
Go to the documentation of this file.
1 <?php
2 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 
18 use Psr\Http\Message\ResponseInterface;
19 use Psr\Http\Message\ServerRequestInterface;
25 
31 {
35  public function ‪__construct()
36  {
37  $this->‪getLanguageService()->‪includeLLFile('EXT:core/Resources/Private/Language/locallang_misc.xlf');
38  }
39 
46  public function ‪getContextMenuAction(ServerRequestInterface $request): ResponseInterface
47  {
48  $contextMenu = GeneralUtility::makeInstance(ContextMenu::class);
49 
50  $params = $request->getQueryParams();
51  $context = $params['context'] ?? '';
52  $items = $contextMenu->getItems($params['table'], $params['uid'], $context);
53  if (!is_array($items)) {
54  $items = [];
55  }
56  return (new ‪JsonResponse())->setPayload($items);
57  }
58 
63  public function ‪clipboardAction(ServerRequestInterface $request): ResponseInterface
64  {
66  $clipboard = GeneralUtility::makeInstance(Clipboard::class);
67  $clipboard->initializeClipboard();
68  $clipboard->lockToNormal();
69 
70  $clipboard->setCmd($request->getQueryParams()['CB']);
71  $clipboard->cleanCurrent();
72 
73  $clipboard->endClipboard();
74  return (new ‪JsonResponse())->setPayload([]);
75  }
76 
83  {
84  return ‪$GLOBALS['LANG'];
85  }
86 }
‪TYPO3\CMS\Core\Localization\LanguageService\includeLLFile
‪mixed includeLLFile($fileRef, $setGlobal=true, $mergeLocalOntoDefault=false)
Definition: LanguageService.php:260
‪TYPO3\CMS\Backend\Clipboard\Clipboard
Definition: Clipboard.php:38
‪TYPO3\CMS\Backend\Controller\ContextMenuController\__construct
‪__construct()
Definition: ContextMenuController.php:35
‪TYPO3\CMS\Backend\Controller\ContextMenuController\clipboardAction
‪ResponseInterface clipboardAction(ServerRequestInterface $request)
Definition: ContextMenuController.php:63
‪TYPO3\CMS\Backend\Controller\ContextMenuController\getLanguageService
‪LanguageService getLanguageService()
Definition: ContextMenuController.php:82
‪TYPO3\CMS\Backend\ContextMenu\ContextMenu
Definition: ContextMenu.php:25
‪TYPO3\CMS\Backend\Controller\ContextMenuController\getContextMenuAction
‪ResponseInterface getContextMenuAction(ServerRequestInterface $request)
Definition: ContextMenuController.php:46
‪TYPO3\CMS\Core\Http\JsonResponse
Definition: JsonResponse.php:25
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:5
‪TYPO3\CMS\Core\Localization\LanguageService
Definition: LanguageService.php:29
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:45
‪TYPO3\CMS\Backend\Controller
Definition: AbstractFormEngineAjaxController.php:3
‪TYPO3\CMS\Backend\Controller\ContextMenuController
Definition: ContextMenuController.php:31