‪TYPO3CMS  9.5
EditModule.php
Go to the documentation of this file.
1 <?php
2 declare(strict_types = 1);
3 
5 
6 /*
7  * This file is part of the TYPO3 CMS project.
8  *
9  * It is free software; you can redistribute it and/or modify it under
10  * the terms of the GNU General Public License, either version 2
11  * of the License, or any later version.
12  *
13  * For the full copyright and license information, please read the
14  * LICENSE.txt file that was distributed with this source code.
15  *
16  * The TYPO3 project - inspiring people to share!
17  */
18 
19 use Psr\Http\Message\ServerRequestInterface;
30 
35 {
41  public function ‪getPageSettings(): string
42  {
43  $editToolbarService = GeneralUtility::makeInstance(EditToolbarService::class);
44  $toolbar = $editToolbarService->createToolbar();
45  $view = GeneralUtility::makeInstance(StandaloneView::class);
46  $templateNameAndPath = 'EXT:adminpanel/Resources/Private/Templates/Modules/Settings/Edit.html';
47  $view->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName($templateNameAndPath));
48  $view->setPartialRootPaths(['EXT:adminpanel/Resources/Private/Partials']);
49  $view->assignMultiple(
50  [
51  'feEdit' => ‪ExtensionManagementUtility::isLoaded('feedit'),
52  'display' => [
53  'fieldIcons' => $this->configurationService->getConfigurationOption('edit', 'displayFieldIcons'),
54  'displayIcons' => $this->configurationService->getConfigurationOption('edit', 'displayIcons'),
55  ],
56  'toolbar' => $toolbar,
57  'script' => [
58  'pageUid' => (int)$this->getTypoScriptFrontendController()->page['uid'],
59  'pageModule' => $this->getPageModule(),
60  'backendScript' => ‪BackendUtility::getBackendScript(),
61  't3BeSitenameMd5' => md5('Typo3Backend-' . ‪$GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']),
62  ],
63  ]
64  );
65  return $view->render();
66  }
67 
72  {
73  return ‪$GLOBALS['TSFE'];
74  }
75 
79  private function ‪getPageModule(): string
80  {
81  $pageModule = trim($this->‪getBackendUser()->getTSConfig()['options.']['overridePageModule'] ?? '');
82  return ‪BackendUtility::isModuleSetInTBE_MODULES($pageModule) ? $pageModule : 'web_layout';
83  }
84 
88  public function ‪getIdentifier(): string
89  {
90  return 'edit';
91  }
92 
96  public function ‪getIconIdentifier(): string
97  {
98  return 'actions-open';
99  }
100 
104  public function ‪getLabel(): string
105  {
106  $locallangFileAndPath = 'LLL:EXT:adminpanel/Resources/Private/Language/locallang_edit.xlf:module.label';
107  return $this->‪getLanguageService()->‪sL($locallangFileAndPath);
108  }
109 
118  public function ‪initializeModule(ServerRequestInterface $request): void
119  {
120  $extFeEditLoaded = ‪ExtensionManagementUtility::isLoaded('feedit');
121  $typoScriptFrontend = $this->‪getTypoScriptFrontendController();
122  $typoScriptFrontend->displayEditIcons = $this->configurationService->getConfigurationOption('edit', 'displayIcons');
123  $typoScriptFrontend->displayFieldEditIcons = $this->configurationService->getConfigurationOption('edit', 'displayFieldIcons');
124 
125  if ($request->getQueryParams()['ADMCMD_editIcons'] ?? $request->getParsedBody()['ADMCMD_editIcons'] ?? false) {
126  $typoScriptFrontend->displayFieldEditIcons = '1';
127  }
128  if ($extFeEditLoaded && $typoScriptFrontend->displayEditIcons) {
129  $typoScriptFrontend->set_no_cache('Admin Panel: Display edit icons', true);
130  }
131  if ($extFeEditLoaded && $typoScriptFrontend->displayFieldEditIcons) {
132  $typoScriptFrontend->set_no_cache('Admin Panel: Display field edit icons', true);
133  }
134  }
135 
139  public function ‪getJavaScriptFiles(): array
140  {
141  return ['EXT:adminpanel/Resources/Public/JavaScript/Modules/Edit.js'];
142  }
143 
149  public function ‪getCssFiles(): array
150  {
151  return [];
152  }
153 }
‪TYPO3\CMS\Backend\Utility\BackendUtility\getBackendScript
‪static string getBackendScript($interface='')
Definition: BackendUtility.php:4471
‪TYPO3\CMS\Adminpanel\ModuleApi\AbstractModule
Definition: AbstractModule.php:30
‪TYPO3\CMS\Backend\Utility\BackendUtility\isModuleSetInTBE_MODULES
‪static bool isModuleSetInTBE_MODULES($modName)
Definition: BackendUtility.php:3763
‪TYPO3\CMS\Adminpanel\Service\EditToolbarService
Definition: EditToolbarService.php:39
‪TYPO3\CMS\Adminpanel\ModuleApi\InitializableInterface
Definition: InitializableInterface.php:34
‪TYPO3\CMS\Adminpanel\Modules\EditModule\getIconIdentifier
‪getIconIdentifier()
Definition: EditModule.php:96
‪TYPO3\CMS\Adminpanel\Modules\EditModule
Definition: EditModule.php:35
‪TYPO3\CMS\Core\Localization\LanguageService\sL
‪string sL($input)
Definition: LanguageService.php:158
‪TYPO3\CMS\Adminpanel\ModuleApi\ResourceProviderInterface
Definition: ResourceProviderInterface.php:26
‪TYPO3\CMS\Adminpanel\Modules\EditModule\getJavaScriptFiles
‪array getJavaScriptFiles()
Definition: EditModule.php:139
‪TYPO3\CMS\Adminpanel\Modules\EditModule\getPageModule
‪string getPageModule()
Definition: EditModule.php:79
‪TYPO3\CMS\Adminpanel\Modules\EditModule\getTypoScriptFrontendController
‪TypoScriptFrontendController getTypoScriptFrontendController()
Definition: EditModule.php:71
‪TYPO3\CMS\Core\Utility\ExtensionManagementUtility
Definition: ExtensionManagementUtility.php:36
‪TYPO3\CMS\Adminpanel\Modules
Definition: CacheModule.php:4
‪TYPO3\CMS\Adminpanel\Modules\EditModule\getCssFiles
‪array getCssFiles()
Definition: EditModule.php:149
‪TYPO3\CMS\Adminpanel\Modules\EditModule\getIdentifier
‪getIdentifier()
Definition: EditModule.php:88
‪TYPO3\CMS\Core\Utility\ExtensionManagementUtility\isLoaded
‪static bool isLoaded($key, $exitOnError=null)
Definition: ExtensionManagementUtility.php:115
‪TYPO3\CMS\Adminpanel\Modules\EditModule\getPageSettings
‪string getPageSettings()
Definition: EditModule.php:41
‪TYPO3\CMS\Backend\Utility\BackendUtility
Definition: BackendUtility.php:72
‪TYPO3\CMS\Adminpanel\ModuleApi\AbstractModule\getLanguageService
‪LanguageService getLanguageService()
Definition: AbstractModule.php:120
‪TYPO3\CMS\Fluid\View\StandaloneView
Definition: StandaloneView.php:32
‪TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController
Definition: TypoScriptFrontendController.php:97
‪TYPO3\CMS\Adminpanel\ModuleApi\PageSettingsProviderInterface
Definition: PageSettingsProviderInterface.php:31
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:5
‪TYPO3\CMS\Adminpanel\Modules\EditModule\getLabel
‪getLabel()
Definition: EditModule.php:104
‪TYPO3\CMS\Adminpanel\Modules\EditModule\initializeModule
‪initializeModule(ServerRequestInterface $request)
Definition: EditModule.php:118
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:45
‪TYPO3\CMS\Adminpanel\ModuleApi\AbstractModule\getBackendUser
‪BackendUserAuthentication FrontendBackendUserAuthentication getBackendUser()
Definition: AbstractModule.php:110