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