TYPO3 CMS  TYPO3_7-6
ModulesController.php
Go to the documentation of this file.
1 <?php
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
24 
31 {
37  protected $languageService;
38 
44  protected $defaultViewObjectName = BackendTemplateView::class;
45 
50  {
51  parent::__construct();
52  $this->languageService = $languageService ?: $GLOBALS['LANG'];
53  }
54 
60  protected function initializeView(ViewInterface $view)
61  {
63  parent::initializeView($view);
64  // Disable Path
65  $view->getModuleTemplate()->getDocHeaderComponent()->setMetaInformation([]);
66  }
67 
73  public function indexAction()
74  {
75  $warnings = [];
76  $securityWarnings = '';
77  // Hook for additional warnings
78  if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_befunc.php']['displayWarningMessages'])) {
79  foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_befunc.php']['displayWarningMessages'] as $classRef) {
80  $hookObj = GeneralUtility::getUserObj($classRef);
81  if (method_exists($hookObj, 'displayWarningMessages_postProcess')) {
82  $hookObj->displayWarningMessages_postProcess($warnings);
83  }
84  }
85  }
86  if (!empty($warnings)) {
87  if (count($warnings) > 1) {
88  $securityWarnings = '<ul><li>' . implode('</li><li>', $warnings) . '</li></ul>';
89  } else {
90  $securityWarnings = '<p>' . implode('', $warnings) . '</p>';
91  }
92  unset($warnings);
93  }
94 
95  $this->view->assignMultiple(
96  [
97  'TYPO3Version' => TYPO3_version,
98  'copyRightNotice' => BackendUtility::TYPO3_copyRightNotice(),
99  'warningMessages' => $securityWarnings,
100  'warningTitle' => $this->languageService->sL('LLL:EXT:lang/locallang_core.xlf:warning.header'),
101  'modules' => $this->getModulesData()
102  ]
103  );
104  }
105 
112  protected function getModulesData()
113  {
115  $loadedModules = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Module\ModuleLoader::class);
116  $loadedModules->observeWorkspaces = true;
117  $loadedModules->load($GLOBALS['TBE_MODULES']);
118  $mainModulesData = [];
119  foreach ($loadedModules->modules as $moduleName => $moduleInfo) {
120  $mainModuleData = [];
121  $moduleKey = $moduleName . '_tab';
122  $mainModuleData['name'] = $moduleName;
123  $mainModuleData['label'] = $this->languageService->moduleLabels['tabs'][$moduleKey];
124  if (is_array($moduleInfo['sub']) && !empty($moduleInfo['sub'])) {
125  $mainModuleData['subModules'] = $this->getSubModuleData($moduleName, $moduleInfo['sub']);
126  }
127  $mainModulesData[] = $mainModuleData;
128  }
129  return $mainModulesData;
130  }
131 
139  protected function getSubModuleData($moduleName, array $subModulesInfo = [])
140  {
141  $subModulesData = [];
142  foreach ($subModulesInfo as $subModuleName => $subModuleInfo) {
143  $subModuleKey = $moduleName . '_' . $subModuleName . '_tab';
144  $subModuleData = [];
145  $subModuleData['name'] = $subModuleName;
146  $subModuleData['icon'] = PathUtility::stripPathSitePrefix($this->languageService->moduleLabels['tabs_images'][$subModuleKey]);
147  $subModuleData['label'] = $this->languageService->moduleLabels['tabs'][$subModuleKey];
148  $subModuleData['shortDescription'] = $this->languageService->moduleLabels['labels'][$subModuleKey . 'label'];
149  $subModuleData['longDescription'] = $this->languageService->moduleLabels['labels'][$subModuleKey . 'descr'];
150  $subModulesData[] = $subModuleData;
151  }
152  return $subModulesData;
153  }
154 }
getSubModuleData($moduleName, array $subModulesInfo=[])
__construct(LanguageService $languageService=null)
if(TYPO3_MODE==='BE') $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['frontendEditingController']['default']