TYPO3 CMS  TYPO3_8-7
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 
24 
29 {
33  public function __construct()
34  {
35  $this->getLanguageService()->includeLLFile('EXT:lang/Resources/Private/Language/locallang_misc.xlf');
36  }
37 
45  public function getContextMenuAction(ServerRequestInterface $request, ResponseInterface $response): ResponseInterface
46  {
47  $contextMenu = GeneralUtility::makeInstance(ContextMenu::class);
48 
49  $params = $request->getQueryParams();
50  $context = isset($params['context']) ? $params['context'] : '';
51  $items = $contextMenu->getItems($params['table'], $params['uid'], $context);
52  if (!is_array($items)) {
53  $items = [];
54  }
55  $response->getBody()->write(json_encode($items));
56  return $response;
57  }
58 
64  public function clipboardAction(ServerRequestInterface $request, ResponseInterface $response): ResponseInterface
65  {
67  $clipboard = GeneralUtility::makeInstance(Clipboard::class);
68  $clipboard->initializeClipboard();
69  $clipboard->lockToNormal();
70 
71  $clipboard->setCmd($request->getQueryParams()['CB']);
72  $clipboard->cleanCurrent();
73 
74  $clipboard->endClipboard();
75  $response->getBody()->write(json_encode([]));
76  return $response;
77  }
78 
84  protected function getLanguageService(): LanguageService
85  {
86  return $GLOBALS['LANG'];
87  }
88 }
static makeInstance($className,... $constructorArguments)
getContextMenuAction(ServerRequestInterface $request, ResponseInterface $response)
if(TYPO3_MODE==='BE') $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['frontendEditingController']['default']