‪TYPO3CMS  ‪main
ElementBrowserController.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;
26 
31 #[AsController]
33 {
43  protected string ‪$mode = '';
44 
45  public function ‪__construct(protected readonly ‪ElementBrowserRegistry $elementBrowserRegistry) {}
46 
54  public function ‪mainAction(ServerRequestInterface $request): ResponseInterface
55  {
56  $this->mode = $request->getQueryParams()['mode'] ?? $request->getQueryParams()['mode'] ?? '';
57  return new ‪HtmlResponse($this->‪main($request));
58  }
59 
65  protected function ‪main(ServerRequestInterface $request)
66  {
67  $browser = $this->elementBrowserRegistry->getElementBrowser($this->mode);
68  if (is_callable([$browser, 'setRequest'])) {
69  $browser->setRequest($request);
70  }
71 
72  $backendUser = $this->‪getBackendUser();
73  $modData = $backendUser->getModuleData('browse_links.php', 'ses');
74  [$modData] = $browser->processSessionData($modData);
75  $backendUser->pushModuleData('browse_links.php', $modData);
76 
77  return $browser->render();
78  }
79 
81  {
82  return ‪$GLOBALS['BE_USER'];
83  }
84 }
‪TYPO3\CMS\Backend\Controller\ElementBrowserController\main
‪string main(ServerRequestInterface $request)
Definition: ElementBrowserController.php:65
‪TYPO3\CMS\Backend\Controller\ElementBrowserController\$mode
‪string $mode
Definition: ElementBrowserController.php:43
‪TYPO3\CMS\Backend\Controller\ElementBrowserController\getBackendUser
‪getBackendUser()
Definition: ElementBrowserController.php:80
‪TYPO3\CMS\Core\Authentication\BackendUserAuthentication
Definition: BackendUserAuthentication.php:62
‪TYPO3\CMS\Backend\ElementBrowser\ElementBrowserRegistry
Definition: ElementBrowserRegistry.php:27
‪TYPO3\CMS\Backend\Controller\ElementBrowserController\mainAction
‪ResponseInterface mainAction(ServerRequestInterface $request)
Definition: ElementBrowserController.php:54
‪TYPO3\CMS\Backend\Controller\ElementBrowserController\__construct
‪__construct(protected readonly ElementBrowserRegistry $elementBrowserRegistry)
Definition: ElementBrowserController.php:45
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:25
‪TYPO3\CMS\Backend\Attribute\AsController
Definition: AsController.php:25
‪TYPO3\CMS\Backend\Controller\ElementBrowserController
Definition: ElementBrowserController.php:33
‪TYPO3\CMS\Backend\Controller
Definition: AboutController.php:18
‪TYPO3\CMS\Core\Http\HtmlResponse
Definition: HtmlResponse.php:28