‪TYPO3CMS  ‪main
AjaxController.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\ServerRequestInterface;
25 
32 {
34 
35  public function ‪__construct(
36  private readonly ‪ConfigurationService $configurationService,
37  private readonly ‪ModuleLoader $moduleLoader,
38  ) {
39  $this->adminPanelModuleConfiguration = ‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules'] ?? [];
40  }
41 
45  public function ‪saveDataAction(ServerRequestInterface $request): ‪JsonResponse
46  {
47  $this->configurationService->saveConfiguration(
48  $this->moduleLoader->validateSortAndInitializeModules($this->adminPanelModuleConfiguration),
49  $request
50  );
51  return new ‪JsonResponse(['success' => true]);
52  }
53 
58  {
59  $backendUser = $this->‪getBackendUser();
60  if ($backendUser->uc['AdminPanel']['display_top'] ?? false) {
61  $backendUser->uc['AdminPanel']['display_top'] = false;
62  } else {
63  $backendUser->uc['AdminPanel']['display_top'] = true;
64  }
65  $backendUser->writeUC();
66  return new ‪JsonResponse(['success' => true]);
67  }
68 
70  {
71  return ‪$GLOBALS['BE_USER'];
72  }
73 }
‪TYPO3\CMS\Adminpanel\Controller\AjaxController\__construct
‪__construct(private readonly ConfigurationService $configurationService, private readonly ModuleLoader $moduleLoader,)
Definition: AjaxController.php:35
‪TYPO3\CMS\Adminpanel\Controller
Definition: AjaxController.php:18
‪TYPO3\CMS\Adminpanel\Service\ModuleLoader
Definition: ModuleLoader.php:32
‪TYPO3\CMS\Adminpanel\Controller\AjaxController\saveDataAction
‪saveDataAction(ServerRequestInterface $request)
Definition: AjaxController.php:45
‪TYPO3\CMS\Adminpanel\Service\ConfigurationService
Definition: ConfigurationService.php:34
‪TYPO3\CMS\Adminpanel\Controller\AjaxController\toggleActiveState
‪toggleActiveState()
Definition: AjaxController.php:57
‪TYPO3\CMS\Adminpanel\Controller\AjaxController\getBackendUser
‪getBackendUser()
Definition: AjaxController.php:69
‪TYPO3\CMS\Core\Authentication\BackendUserAuthentication
Definition: BackendUserAuthentication.php:62
‪TYPO3\CMS\Adminpanel\Controller\AjaxController
Definition: AjaxController.php:32
‪TYPO3\CMS\Adminpanel\Controller\AjaxController\$adminPanelModuleConfiguration
‪array $adminPanelModuleConfiguration
Definition: AjaxController.php:33
‪TYPO3\CMS\Core\Http\JsonResponse
Definition: JsonResponse.php:28
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:25